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/04/04 07:26:05 UTC
[01/51] [abbrv] [OLINGO-200] Introducing interfaces for domain object
Repository: olingo-odata4
Updated Branches:
refs/heads/olingo-206-validator b25080359 -> 6d66ff391
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
new file mode 100644
index 0000000..1189aae
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
@@ -0,0 +1,90 @@
+/*
+ * 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.commons.core.domain;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
+
+/**
+ * OData collection property value.
+ */
+public class ODataCollectionValueImpl extends AbstractODataValue implements ODataCollectionValue {
+
+ private static final long serialVersionUID = -3665659846001987187L;
+
+ /**
+ * Values.
+ */
+ private final List<ODataValue> values = new ArrayList<ODataValue>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public ODataCollectionValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * Adds a value to the collection.
+ *
+ * @param value value to be added.
+ */
+ @Override
+ public void add(final ODataValue value) {
+ if (value.isPrimitive() || value.isComplex()) {
+ values.add(value);
+ }
+ }
+
+ /**
+ * Value iterator.
+ *
+ * @return value iterator.
+ */
+ @Override
+ public Iterator<ODataValue> iterator() {
+ return values.iterator();
+ }
+
+ /**
+ * Gets collection size.
+ *
+ * @return collection size.
+ */
+ @Override
+ public int size() {
+ return values.size();
+ }
+
+ /**
+ * Checks if collection is empty.
+ *
+ * @return 'TRUE' if empty; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isEmpty() {
+ return values.isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
new file mode 100644
index 0000000..07d6055
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
@@ -0,0 +1,89 @@
+/*
+ * 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.commons.core.domain;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+
+/**
+ * OData complex property value.
+ */
+public class ODataComplexValueImpl extends AbstractODataValue implements ODataComplexValue {
+
+ private static final long serialVersionUID = -1878555027714020431L;
+
+ /**
+ * Complex type fields.
+ */
+ private final Map<String, ODataProperty> fields = new LinkedHashMap<String, ODataProperty>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public ODataComplexValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * Adds field to the complex type.
+ *
+ * @param field field to be added.
+ */
+ @Override
+ public void add(final ODataProperty field) {
+ fields.put(field.getName(), field);
+ }
+
+ /**
+ * Gets field.
+ *
+ * @param name name of the field to be retrieved.
+ * @return requested field.
+ */
+ @Override
+ public ODataProperty get(final String name) {
+ return fields.get(name);
+ }
+
+ /**
+ * Complex property fields iterator.
+ *
+ * @return fields iterator.
+ */
+ @Override
+ public Iterator<ODataProperty> iterator() {
+ return fields.values().iterator();
+ }
+
+ /**
+ * Gets number of fields.
+ *
+ * @return number of fields.
+ */
+ @Override
+ public int size() {
+ return fields.size();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
new file mode 100644
index 0000000..62d1e42
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
@@ -0,0 +1,372 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.domain.AbstractODataPayload;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+
+/**
+ * OData entity.
+ */
+public class ODataEntityImpl extends AbstractODataPayload implements ODataEntity {
+
+ private static final long serialVersionUID = 8360640095932811034L;
+
+ /**
+ * Entity reference.
+ */
+ private String reference;
+
+ /**
+ * ETag.
+ */
+ private String eTag;
+
+ /**
+ * Media entity flag.
+ */
+ private boolean mediaEntity = false;
+
+ /**
+ * In case of media entity, media content type.
+ */
+ private String mediaContentType;
+
+ /**
+ * In case of media entity, media content source.
+ */
+ private String mediaContentSource;
+
+ /**
+ * Edit link.
+ */
+ private URI editLink;
+
+ /**
+ * Navigation links (might contain in-line entities or feeds).
+ */
+ private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Association links.
+ */
+ private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Media edit links.
+ */
+ private final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Operations (legacy, functions, actions).
+ */
+ private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
+
+ /**
+ * Entity properties.
+ */
+ private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
+
+ /**
+ * Constructor.
+ *
+ * @param name OData entity name.
+ */
+ public ODataEntityImpl(final String name) {
+ super(name);
+ }
+
+ /**
+ * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
+ * to the resource path.
+ * <br />
+ * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
+ * <br />
+ * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
+ * collection of entity references pointing to the related entities. If no entities are related, the response is the
+ * format-specific representation of an empty collection.
+ * <br />
+ * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
+ * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
+ * such entity exists, the service returns 404 Not Found.
+ *
+ * @return entity reference.
+ */
+ @Override
+ public String getReference() {
+ return reference;
+ }
+
+ @Override
+ public void setReference(final String reference) {
+ this.reference = reference;
+ }
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ @Override
+ public String getETag() {
+ return eTag;
+ }
+
+ /**
+ * Sets ETag.
+ *
+ * @param eTag ETag.
+ */
+ @Override
+ public void setETag(final String eTag) {
+ this.eTag = eTag;
+ }
+
+ /**
+ * Searches for operation with given title.
+ *
+ * @param title operation to look for
+ * @return operation if found with given title, <tt>null</tt> otherwise
+ */
+ @Override
+ public ODataOperation getOperation(final String title) {
+ ODataOperation result = null;
+ for (ODataOperation operation : operations) {
+ if (title.equals(operation.getTitle())) {
+ result = operation;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ @Override
+ public List<ODataOperation> getOperations() {
+ return this.operations;
+ }
+
+ /**
+ * Searches for property with given name.
+ *
+ * @param name property to look for
+ * @return property if found with given name, <tt>null</tt> otherwise
+ */
+ @Override
+ public ODataProperty getProperty(final String name) {
+ ODataProperty result = null;
+
+ if (StringUtils.isNotBlank(name)) {
+ for (ODataProperty property : properties) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns OData entity properties.
+ *
+ * @return OData entity properties.
+ */
+ @Override
+ public List<ODataProperty> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Puts the given link into one of available lists, based on its type.
+ *
+ * @param link to be added
+ * @return <tt>true</tt> if the given link was added in one of available lists
+ */
+ @Override
+ public boolean addLink(final ODataLink link) {
+ boolean result = false;
+
+ switch (link.getType()) {
+ case ASSOCIATION:
+ result = associationLinks.contains(link) ? false : associationLinks.add(link);
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
+ break;
+
+ case MEDIA_EDIT:
+ result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ /**
+ * Removes the given link from any list (association, navigation, edit-media).
+ *
+ * @param link to be removed
+ * @return <tt>true</tt> if the given link was contained in one of available lists
+ */
+ @Override
+ public boolean removeLink(final ODataLink link) {
+ return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
+ }
+
+ /**
+ * Returns all entity navigation links (including inline entities / feeds).
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ /**
+ * Returns all entity association links.
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ /**
+ * Returns all entity media edit links.
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getEditMediaLinks() {
+ return editMediaLinks;
+ }
+
+ /**
+ * Returns OData entity edit link.
+ *
+ * @return entity edit link.
+ */
+ @Override
+ public URI getEditLink() {
+ return editLink;
+ }
+
+ /**
+ * Sets OData entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ @Override
+ public void setEditLink(final URI editLink) {
+ this.editLink = editLink;
+ }
+
+ @Override
+ public URI getLink() {
+ return super.getLink() == null ? getEditLink() : super.getLink();
+ }
+
+ /**
+ * TRUE if read-only entity.
+ *
+ * @return TRUE if read-only; FALSE otherwise.
+ */
+ @Override
+ public boolean isReadOnly() {
+ return super.getLink() != null;
+ }
+
+ /**
+ * Checks if the current entity is a media entity.
+ *
+ * @return 'TRUE' if media entity; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isMediaEntity() {
+ return mediaEntity;
+ }
+
+ /**
+ * Sets media entity flag.
+ *
+ * @param isMediaEntity media entity flag value.
+ */
+ @Override
+ public void setMediaEntity(final boolean isMediaEntity) {
+ this.mediaEntity = isMediaEntity;
+ }
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ @Override
+ public String getMediaContentType() {
+ return mediaContentType;
+ }
+
+ /**
+ * Sets media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ @Override
+ public void setMediaContentType(final String mediaContentType) {
+ this.mediaContentType = mediaContentType;
+ }
+
+ /**
+ * Gets media content source.
+ *
+ * @return media content source.
+ */
+ @Override
+ public String getMediaContentSource() {
+ return mediaContentSource;
+ }
+
+ /**
+ * Sets media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ @Override
+ public void setMediaContentSource(final String mediaContentSource) {
+ this.mediaContentSource = mediaContentSource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
new file mode 100644
index 0000000..b7246d1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
@@ -0,0 +1,104 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.AbstractODataPayload;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+
+public class ODataEntitySetImpl extends AbstractODataPayload implements ODataEntitySet {
+
+ private static final long serialVersionUID = 9039605899821494024L;
+
+ /**
+ * Link to the next page.
+ */
+ private URI next;
+
+ /**
+ * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
+ * there.
+ */
+ private Integer count;
+
+ /**
+ * OData entities contained in this feed.
+ */
+ private List<ODataEntity> entities = new ArrayList<ODataEntity>();
+
+ /**
+ * Constructor.
+ */
+ public ODataEntitySetImpl() {
+ super(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next link.
+ */
+ public ODataEntitySetImpl(final URI next) {
+ super(null);
+ this.next = next;
+ }
+
+ /**
+ * Gets next page link.
+ *
+ * @return next page link; null value if single page or last page reached.
+ */
+ @Override
+ public URI getNext() {
+ return next;
+ }
+
+ /**
+ * Gets contained entities.
+ *
+ * @return feed entries.
+ */
+ @Override
+ public List<ODataEntity> getEntities() {
+ return entities;
+ }
+
+ /**
+ * Gets in-line count.
+ *
+ * @return in-line count value.
+ */
+ @Override
+ public int getCount() {
+ return count == null ? entities.size() : count;
+ }
+
+ /**
+ * Sets in-line count.
+ *
+ * @param count in-line count value.
+ */
+ @Override
+ public void setCount(final int count) {
+ this.count = count;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
new file mode 100644
index 0000000..63a47ce
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
@@ -0,0 +1,171 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataObjectFactoryImpl implements ODataObjectFactory {
+
+ private static final long serialVersionUID = -3769695665946919447L;
+
+ protected final ODataServiceVersion version;
+
+ public ODataObjectFactoryImpl(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet() {
+ return new ODataEntitySetImpl();
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet(final URI next) {
+ return new ODataEntitySetImpl(next);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name) {
+ return new ODataEntityImpl(name);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name, final URI link) {
+ final ODataEntityImpl result = new ODataEntityImpl(name);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
+ final ODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
+ final ODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
+ return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
+ final ODataEntity entity) {
+
+ return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(version);
+ }
+
+ @Override
+ public ODataComplexValue newComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ODataCollectionValue newCollectionValue(final String typeName) {
+ return new ODataCollectionValueImpl(typeName);
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
index ad60494..965d5fc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
@@ -139,6 +139,15 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData
*/
private Object value;
+ private ODataPrimitiveValueImpl() {
+ super(null);
+ }
+
+ @Override
+ public String getTypeName() {
+ return typeKind.getFullQualifiedName().toString();
+ }
+
@Override
public EdmPrimitiveTypeKind getTypeKind() {
return typeKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
new file mode 100644
index 0000000..4c8aea9
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
@@ -0,0 +1,172 @@
+/*
+ * 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.commons.core.domain;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+
+/**
+ * OData entity property.
+ */
+public class ODataPropertyImpl implements ODataProperty {
+
+ private static final long serialVersionUID = 926939448778950450L;
+
+ /**
+ * Property name.
+ */
+ private final String name;
+
+ /**
+ * Property value.
+ */
+ private ODataValue value;
+
+ /**
+ * Constructor.
+ *
+ * @param name property name.
+ * @param value property value.
+ */
+ public ODataPropertyImpl(final String name, final ODataValue value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Returns property name.
+ *
+ * @return property name.
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns property value.
+ *
+ * @return property value.
+ */
+ @Override
+ public ODataValue getValue() {
+ return value;
+ }
+
+ /**
+ * Checks if has null value.
+ *
+ * @return 'TRUE' if has null value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasNullValue() {
+ return this.value == null;
+ }
+
+ /**
+ * Checks if has primitive value.
+ *
+ * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasPrimitiveValue() {
+ return !hasNullValue() && this.value.isPrimitive();
+ }
+
+ /**
+ * Gets primitive value.
+ *
+ * @return primitive value if exists; null otherwise.
+ */
+ @Override
+ public ODataPrimitiveValue getPrimitiveValue() {
+ return hasPrimitiveValue() ? this.value.asPrimitive() : null;
+ }
+
+ /**
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasComplexValue() {
+ return !hasNullValue() && this.value.isComplex();
+ }
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ @Override
+ public ODataComplexValue getComplexValue() {
+ return hasComplexValue() ? this.value.asComplex() : null;
+ }
+
+ /**
+ * Checks if has collection value.
+ *
+ * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasCollectionValue() {
+ return !hasNullValue() && this.value.isCollection();
+ }
+
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ @Override
+ public ODataCollectionValue getCollectionValue() {
+ return hasCollectionValue() ? this.value.asCollection() : null;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
deleted file mode 100644
index ae946e0..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
+++ /dev/null
@@ -1,156 +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.commons.core.op;
-
-import java.net.URI;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public class ODataObjectFactoryImpl implements ODataObjectFactory {
-
- private static final long serialVersionUID = -3769695665946919447L;
-
- protected final ODataServiceVersion version;
-
- public ODataObjectFactoryImpl(final ODataServiceVersion version) {
- this.version = version;
- }
-
- @Override
- public ODataEntitySet newEntitySet() {
- return new ODataEntitySet();
- }
-
- @Override
- public ODataEntitySet newEntitySet(final URI next) {
- return new ODataEntitySet(next);
- }
-
- @Override
- public ODataEntity newEntity(final String name) {
- return new ODataEntity(name);
- }
-
- @Override
- public ODataEntity newEntity(final String name, final URI link) {
- final ODataEntity result = new ODataEntity(name);
- result.setLink(link);
- return result;
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
- return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
- final ODataEntity entity) {
-
- return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
- return new ODataProperty(name, value);
- }
-
-}
[05/51] [abbrv] [OLINGO-200] Introducing specialization for V3 and V4
domain objects
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
index 6d2a89d..7806fd0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
@@ -19,11 +19,6 @@
package org.apache.olingo.client.core.it.v4;
import java.net.URI;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@@ -31,17 +26,24 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
import org.apache.olingo.commons.core.op.ResourceFactory;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Ignore;
import org.junit.Test;
@@ -58,11 +60,12 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getName());
@@ -75,13 +78,13 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
for (ODataLink link : entity.getNavigationLinks()) {
if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
assertNotNull(inline);
debugEntry(client.getBinder().getEntry(
inline, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)), "Just read");
- final List<ODataProperty> properties = inline.getProperties();
+ final List<? extends CommonODataProperty> properties = inline.getProperties();
assertEquals(5, properties.size());
assertTrue(properties.get(0).getName().equals("CompanyID")
@@ -118,18 +121,19 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
boolean found = false;
for (ODataLink link : entity.getNavigationLinks()) {
if (link instanceof ODataInlineEntitySet) {
- final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
assertNotNull(inline);
debugFeed(client.getBinder().getFeed(inline, ResourceFactory.feedClassForFormat(
@@ -191,11 +195,11 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
assertEquals(Integer.valueOf(1),
entity.getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class));
@@ -227,7 +231,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Orders").appendKeySegment(8);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -236,7 +240,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final String etag = res.getEtag();
assertTrue(StringUtils.isNotBlank(etag));
- final ODataEntity order = res.getBody();
+ final CommonODataEntity order = res.getBody();
assertEquals(etag, order.getETag());
}
@@ -245,7 +249,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
public void issue99() {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.JSON);
// this statement should cause an IllegalArgumentException bearing JsonParseException
@@ -269,7 +273,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
appendRefSegment();
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
ODataRetrieveResponse<ODataEntity> res = req.execute();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index 2d78a6d..a73ce7a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -18,10 +18,6 @@
*/
package org.apache.olingo.client.core.it.v4;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
@@ -32,9 +28,14 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Ignore;
import org.junit.Test;
@@ -96,11 +97,12 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("People");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
- final ODataEntitySet feed = res.getBody();
+ final CommonODataEntitySet feed = res.getBody();
assertNotNull(feed);
@@ -151,7 +153,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final ODataRawResponse res = req.execute();
assertNotNull(res);
- final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+ final CommonODataEntitySet entitySet = res.getBodyAs(CommonODataEntitySet.class);
assertNotNull(entitySet);
assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People"));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
index 93ee5fe..cddd66d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
@@ -18,20 +18,20 @@
*/
package org.apache.olingo.client.core.it.v4;
-import static org.junit.Assert.*;
import java.io.IOException;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
-import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
+import static org.junit.Assert.*;
import org.junit.Test;
public class PropertyValueTestITCase extends AbstractTestITCase {
@@ -124,7 +124,8 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveCollectionPropertyValueTest() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers");
- final ODataPropertyRequest req = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
req.setFormat(ODataFormat.XML);
final ODataProperty property = req.execute().getBody();
assertTrue(property.getValue().isCollection());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index 0812c6d..1f02432 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.core.op.ResourceFactory;
@@ -39,14 +39,14 @@ public class EntitySetTest extends AbstractTest {
private void read(final ODataPubFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
- final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ final CommonODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
getClient().getDeserializer().toFeed(input, format).getObject());
assertNotNull(entitySet);
assertEquals(2, entitySet.getEntities().size());
assertNotNull(entitySet.getNext());
- final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
+ final CommonODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
getBinder().getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entitySet, written);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 80c56c2..fe5b148 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -24,9 +24,9 @@ import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -45,7 +45,7 @@ public class EntityTest extends AbstractTest {
private void readAndWrite(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Customer_-10." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
@@ -64,7 +64,7 @@ public class EntityTest extends AbstractTest {
assertTrue(check);
- final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -81,12 +81,12 @@ public class EntityTest extends AbstractTest {
private void readGeospatial(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-8." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
boolean found = false;
- for (ODataProperty property : entity.getProperties()) {
+ for (CommonODataProperty property : entity.getProperties()) {
if ("GeogMultiLine".equals(property.getName())) {
found = true;
assertTrue(property.hasPrimitiveValue());
@@ -95,7 +95,7 @@ public class EntityTest extends AbstractTest {
}
assertTrue(found);
- final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -113,14 +113,14 @@ public class EntityTest extends AbstractTest {
private void withActions(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("ComputerDetail_-10." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertEquals(1, entity.getOperations().size());
assertEquals("ResetComputerDetailsSpecifications", entity.getOperations().get(0).getTitle());
- final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
entity.getOperations().clear();
assertEquals(entity, written);
@@ -139,14 +139,14 @@ public class EntityTest extends AbstractTest {
private void mediaEntity(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Car_16." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertTrue(entity.isMediaEntity());
assertNotNull(entity.getMediaContentSource());
assertNotNull(entity.getMediaContentType());
- final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -163,11 +163,11 @@ public class EntityTest extends AbstractTest {
private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
- final ODataProperty geogCollection = entity.getProperty("GeogCollection");
+ final CommonODataProperty geogCollection = entity.getProperty("GeogCollection");
assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getPrimitiveValue().getTypeKind());
int count = 0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 6d46398..4b3167e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -57,15 +57,15 @@ public class PropertyTest extends AbstractTest {
assertEquals("-10", value.toString());
}
- private ODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
+ private CommonODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId." + getSuffix(format));
- final ODataProperty property = getClient().getReader().readProperty(input, format);
+ final CommonODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasPrimitiveValue());
assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class));
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
+ CommonODataProperty comparable;
+ final CommonODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
@@ -93,15 +93,15 @@ public class PropertyTest extends AbstractTest {
primitive(ODataFormat.JSON);
}
- private ODataProperty complex(final ODataFormat format) throws IOException {
+ private CommonODataProperty complex(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_PrimaryContactInfo." + getSuffix(format));
- final ODataProperty property = getClient().getReader().readProperty(input, format);
+ final CommonODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasComplexValue());
assertEquals(6, property.getComplexValue().size());
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
+ CommonODataProperty comparable;
+ final CommonODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
@@ -109,8 +109,8 @@ public class PropertyTest extends AbstractTest {
// This is needed because type information gets lost with JSON serialization
final ODataComplexValue typedValue = getClient().getObjectFactory().
newComplexValue(property.getComplexValue().getTypeName());
- for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
- final ODataProperty prop = itor.next();
+ for (final Iterator<CommonODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+ final CommonODataProperty prop = itor.next();
typedValue.add(prop);
}
comparable = getClient().getObjectFactory().newComplexProperty(written.getName(), typedValue);
@@ -131,15 +131,15 @@ public class PropertyTest extends AbstractTest {
complex(ODataFormat.JSON);
}
- private ODataProperty collection(final ODataFormat format) throws IOException {
+ private CommonODataProperty collection(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_BackupContactInfo." + getSuffix(format));
- final ODataProperty property = getClient().getReader().readProperty(input, format);
+ final CommonODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasCollectionValue());
assertEquals(9, property.getCollectionValue().size());
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
+ CommonODataProperty comparable;
+ final CommonODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
new file mode 100644
index 0000000..f4b0d2f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
@@ -0,0 +1,177 @@
+/*
+ * 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.commons.api.domain;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * OData entity.
+ */
+public interface CommonODataEntity extends ODataInvokeResult {
+
+ String getName();
+
+ URI getLink();
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ String getETag();
+
+ /**
+ * Sets ETag.
+ *
+ * @param eTag ETag.
+ */
+ void setETag(String eTag);
+
+ /**
+ * Searches for operation with given title.
+ *
+ * @param title operation to look for
+ * @return operation if found with given title, <tt>null</tt> otherwise
+ */
+ ODataOperation getOperation(String title);
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ List<ODataOperation> getOperations();
+
+ /**
+ * Searches for property with given name.
+ *
+ * @param name property to look for
+ * @return property if found with given name, <tt>null</tt> otherwise
+ */
+ CommonODataProperty getProperty(String name);
+
+ /**
+ * Returns OData entity properties.
+ *
+ * @return OData entity properties.
+ */
+ List<? extends CommonODataProperty> getProperties();
+
+ /**
+ * Puts the given link into one of available lists, based on its type.
+ *
+ * @param link to be added
+ * @return <tt>true</tt> if the given link was added in one of available lists
+ */
+ boolean addLink(ODataLink link);
+
+ /**
+ * Removes the given link from any list (association, navigation, edit-media).
+ *
+ * @param link to be removed
+ * @return <tt>true</tt> if the given link was contained in one of available lists
+ */
+ boolean removeLink(ODataLink link);
+
+ /**
+ * Returns all entity association links.
+ *
+ * @return OData entity links.
+ */
+ List<ODataLink> getAssociationLinks();
+
+ /**
+ * Returns all entity navigation links (including inline entities / feeds).
+ *
+ * @return OData entity links.
+ */
+ List<ODataLink> getNavigationLinks();
+
+ /**
+ * Returns all entity media edit links.
+ *
+ * @return OData entity links.
+ */
+ List<ODataLink> getEditMediaLinks();
+
+ /**
+ * Returns OData entity edit link.
+ *
+ * @return entity edit link.
+ */
+ URI getEditLink();
+
+ /**
+ * Sets OData entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ void setEditLink(URI editLink);
+
+ /**
+ * TRUE if read-only entity.
+ *
+ * @return TRUE if read-only; FALSE otherwise.
+ */
+ boolean isReadOnly();
+
+ /**
+ * Checks if the current entity is a media entity.
+ *
+ * @return 'TRUE' if media entity; 'FALSE' otherwise.
+ */
+ boolean isMediaEntity();
+
+ /**
+ * Sets media entity flag.
+ *
+ * @param isMediaEntity media entity flag value.
+ */
+ void setMediaEntity(boolean isMediaEntity);
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ String getMediaContentType();
+
+ /**
+ * Sets media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ void setMediaContentType(String mediaContentType);
+
+ /**
+ * Gets media content source.
+ *
+ * @return media content source.
+ */
+ String getMediaContentSource();
+
+ /**
+ * Sets media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ void setMediaContentSource(String mediaContentSource);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
new file mode 100644
index 0000000..3967748
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
@@ -0,0 +1,57 @@
+/*
+ * 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.commons.api.domain;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available.
+ */
+public interface CommonODataEntitySet extends ODataInvokeResult {
+
+ /**
+ * Gets next page link.
+ *
+ * @return next page link; null value if single page or last page reached.
+ */
+ URI getNext();
+
+ /**
+ * Gets contained entities.
+ *
+ * @return feed entries.
+ */
+ List<? extends CommonODataEntity> getEntities();
+
+ /**
+ * Gets in-line count.
+ *
+ * @return in-line count value.
+ */
+ int getCount();
+
+ /**
+ * Sets in-line count.
+ *
+ * @param count in-line count value.
+ */
+ void setCount(final int count);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
new file mode 100644
index 0000000..525dc9d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
@@ -0,0 +1,210 @@
+/*
+ * 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.commons.api.domain;
+
+import java.net.URI;
+
+/**
+ * Entry point for generating OData domain objects.
+ */
+public interface CommonODataObjectFactory {
+
+ /**
+ * Instantiates a new entity set.
+ *
+ * @return entity set.
+ */
+ CommonODataEntitySet newEntitySet();
+
+ /**
+ * Instantiates a new entity set.
+ *
+ * @param next next link.
+ * @return entity set.
+ */
+ CommonODataEntitySet newEntitySet(URI next);
+
+ /**
+ * Instantiates a new entity.
+ *
+ * @param name OData entity name.
+ * @return entity.
+ */
+ CommonODataEntity newEntity(String name);
+
+ /**
+ * Instantiates a new entity.
+ *
+ * @param name OData entity name.
+ * @param link self link.
+ * @return entity.
+ */
+ CommonODataEntity newEntity(String name, URI link);
+
+ /**
+ * Instantiates a new in-line entity set.
+ *
+ * @param name name.
+ * @param link edit link.
+ * @param entitySet entity set.
+ * @return in-line entity set.
+ */
+ ODataInlineEntitySet newInlineEntitySet(String name, URI link, CommonODataEntitySet entitySet);
+
+ /**
+ * Instantiates a new in-line entity set.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param entitySet entity set.
+ * @return in-line entity set.
+ */
+ ODataInlineEntitySet newInlineEntitySet(String name, URI baseURI, String href, CommonODataEntitySet entitySet);
+
+ /**
+ * Instantiates a new in-line entity.
+ *
+ * @param name name.
+ * @param link edit link.
+ * @param entity entity.
+ * @return in-line entity.
+ */
+ ODataInlineEntity newInlineEntity(String name, URI link, CommonODataEntity entity);
+
+ /**
+ * Instantiates a new in-line entity.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param entity entity.
+ * @return in-line entity.
+ */
+ ODataInlineEntity newInlineEntity(String name, URI baseURI, String href, CommonODataEntity entity);
+
+ /**
+ * Instantiates a new entity navigation link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return entity navigation link.
+ */
+ ODataLink newEntityNavigationLink(String name, URI link);
+
+ /**
+ * Instantiates a new entity navigation link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return entity navigation link.
+ */
+ ODataLink newEntityNavigationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new entity set navigation link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return entity set navigation link.
+ */
+ ODataLink newFeedNavigationLink(String name, URI link);
+
+ /**
+ * Instantiates a new entity set navigation link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return entity set navigation link.
+ */
+ ODataLink newFeedNavigationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new association link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return association link.
+ */
+ ODataLink newAssociationLink(String name, URI link);
+
+ /**
+ * Instantiates a new association link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return association link.
+ */
+ ODataLink newAssociationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new media-edit link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return media-edit link.
+ */
+ ODataLink newMediaEditLink(String name, URI link);
+
+ /**
+ * Instantiates a new media-edit link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return media-edit link.
+ */
+ ODataLink newMediaEditLink(String name, URI baseURI, String href);
+
+ ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
+
+ ODataComplexValue newComplexValue(String typeName);
+
+ ODataCollectionValue newCollectionValue(String typeName);
+
+ /**
+ * Instantiates a new primitive property.
+ *
+ * @param name name.
+ * @param value primitive value.
+ * @return primitive property.
+ */
+ CommonODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
+
+ /**
+ * Instantiates a new complex property.
+ *
+ * @param name name.
+ * @param value value.
+ * @return complex property.
+ */
+ CommonODataProperty newComplexProperty(String name, ODataComplexValue value);
+
+ /**
+ * Instantiates a new collection property.
+ *
+ * @param name name.
+ * @param value value.
+ * @return collection property.
+ */
+ CommonODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
new file mode 100644
index 0000000..99a5131
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
@@ -0,0 +1,91 @@
+/*
+ * 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.commons.api.domain;
+
+import java.io.Serializable;
+
+/**
+ * OData entity property.
+ */
+public interface CommonODataProperty extends ODataInvokeResult, Serializable {
+
+ /**
+ * Returns property name.
+ *
+ * @return property name.
+ */
+ String getName();
+
+ /**
+ * Checks if has null value.
+ *
+ * @return 'TRUE' if has null value; 'FALSE' otherwise.
+ */
+ boolean hasNullValue();
+
+ /**
+ * Checks if has primitive value.
+ *
+ * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+ */
+ boolean hasPrimitiveValue();
+
+ /**
+ * Gets primitive value.
+ *
+ * @return primitive value if exists; null otherwise.
+ */
+ ODataPrimitiveValue getPrimitiveValue();
+
+ /**
+ * Returns property value.
+ *
+ * @return property value.
+ */
+ ODataValue getValue();
+
+ /**
+ * Checks if has collection value.
+ *
+ * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+ */
+ boolean hasCollectionValue();
+
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ ODataCollectionValue getCollectionValue();
+
+ /**
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+ */
+ boolean hasComplexValue();
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ ODataComplexValue getComplexValue();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
index ea4d832..b34006c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
@@ -21,14 +21,14 @@ package org.apache.olingo.commons.api.domain;
/**
* OData complex property value.
*/
-public interface ODataComplexValue extends ODataValue, Iterable<ODataProperty> {
+public interface ODataComplexValue extends ODataValue, Iterable<CommonODataProperty> {
/**
* Adds field to the complex type.
*
* @param field field to be added.
*/
- void add(ODataProperty field);
+ void add(CommonODataProperty field);
/**
* Gets field.
@@ -36,7 +36,7 @@ public interface ODataComplexValue extends ODataValue, Iterable<ODataProperty> {
* @param name name of the field to be retrieved.
* @return requested field.
*/
- ODataProperty get(String name);
+ CommonODataProperty get(String name);
/**
* Gets number of fields.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
deleted file mode 100644
index 44214ac..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
+++ /dev/null
@@ -1,197 +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.commons.api.domain;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * OData entity.
- */
-public interface ODataEntity extends ODataInvokeResult {
-
- String getName();
-
- URI getLink();
-
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
- String getETag();
-
- /**
- * Sets ETag.
- *
- * @param eTag ETag.
- */
- void setETag(String eTag);
-
- /**
- * Searches for operation with given title.
- *
- * @param title operation to look for
- * @return operation if found with given title, <tt>null</tt> otherwise
- */
- ODataOperation getOperation(String title);
-
- /**
- * Gets operations.
- *
- * @return operations.
- */
- List<ODataOperation> getOperations();
-
- /**
- * Searches for property with given name.
- *
- * @param name property to look for
- * @return property if found with given name, <tt>null</tt> otherwise
- */
- ODataProperty getProperty(String name);
-
- /**
- * Returns OData entity properties.
- *
- * @return OData entity properties.
- */
- List<ODataProperty> getProperties();
-
- /**
- * Puts the given link into one of available lists, based on its type.
- *
- * @param link to be added
- * @return <tt>true</tt> if the given link was added in one of available lists
- */
- boolean addLink(ODataLink link);
-
- /**
- * Removes the given link from any list (association, navigation, edit-media).
- *
- * @param link to be removed
- * @return <tt>true</tt> if the given link was contained in one of available lists
- */
- boolean removeLink(ODataLink link);
-
- /**
- * Returns all entity association links.
- *
- * @return OData entity links.
- */
- List<ODataLink> getAssociationLinks();
-
- /**
- * Returns all entity navigation links (including inline entities / feeds).
- *
- * @return OData entity links.
- */
- List<ODataLink> getNavigationLinks();
-
- /**
- * Returns all entity media edit links.
- *
- * @return OData entity links.
- */
- List<ODataLink> getEditMediaLinks();
-
- /**
- * Returns OData entity edit link.
- *
- * @return entity edit link.
- */
- URI getEditLink();
-
- /**
- * Sets OData entity edit link.
- *
- * @param editLink edit link.
- */
- void setEditLink(URI editLink);
-
- /**
- * TRUE if read-only entity.
- *
- * @return TRUE if read-only; FALSE otherwise.
- */
- boolean isReadOnly();
-
- /**
- * Checks if the current entity is a media entity.
- *
- * @return 'TRUE' if media entity; 'FALSE' otherwise.
- */
- boolean isMediaEntity();
-
- /**
- * Sets media entity flag.
- *
- * @param isMediaEntity media entity flag value.
- */
- void setMediaEntity(boolean isMediaEntity);
-
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
- String getMediaContentType();
-
- /**
- * Sets media content type.
- *
- * @param mediaContentType media content type.
- */
- void setMediaContentType(String mediaContentType);
-
- /**
- * Gets media content source.
- *
- * @return media content source.
- */
- String getMediaContentSource();
-
- /**
- * Sets media content source.
- *
- * @param mediaContentSource media content source.
- */
- void setMediaContentSource(String mediaContentSource);
-
- /**
- * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
- * to the resource path.
- * <br />
- * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
- * <br />
- * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
- * collection of entity references pointing to the related entities. If no entities are related, the response is the
- * format-specific representation of an empty collection.
- * <br />
- * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
- * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
- * such entity exists, the service returns 404 Not Found.
- *
- * @return entity reference.
- */
- String getReference();
-
- void setReference(String reference);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
deleted file mode 100644
index 99b6962..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
+++ /dev/null
@@ -1,57 +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.commons.api.domain;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available.
- */
-public interface ODataEntitySet extends ODataInvokeResult {
-
- /**
- * Gets next page link.
- *
- * @return next page link; null value if single page or last page reached.
- */
- URI getNext();
-
- /**
- * Gets contained entities.
- *
- * @return feed entries.
- */
- List<ODataEntity> getEntities();
-
- /**
- * Gets in-line count.
- *
- * @return in-line count value.
- */
- int getCount();
-
- /**
- * Sets in-line count.
- *
- * @param count in-line count value.
- */
- void setCount(final int count);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
index 46e29dd..67e5bb4 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
@@ -28,7 +28,7 @@ public class ODataInlineEntity extends ODataLink {
private static final long serialVersionUID = -4763341581843700743L;
- private final ODataEntity entity;
+ private final CommonODataEntity entity;
/**
* Constructor.
@@ -40,7 +40,7 @@ public class ODataInlineEntity extends ODataLink {
* @param entity entity.
*/
public ODataInlineEntity(final ODataServiceVersion version,
- final URI uri, final ODataLinkType type, final String title, final ODataEntity entity) {
+ final URI uri, final ODataLinkType type, final String title, final CommonODataEntity entity) {
super(version, uri, type, title);
this.entity = entity;
@@ -57,7 +57,7 @@ public class ODataInlineEntity extends ODataLink {
* @param entity entity.
*/
public ODataInlineEntity(final ODataServiceVersion version, final URI baseURI, final String href,
- final ODataLinkType type, final String title, final ODataEntity entity) {
+ final ODataLinkType type, final String title, final CommonODataEntity entity) {
super(version, baseURI, href, type, title);
this.entity = entity;
@@ -68,7 +68,7 @@ public class ODataInlineEntity extends ODataLink {
*
* @return wrapped entity.
*/
- public ODataEntity getEntity() {
+ public CommonODataEntity getEntity() {
return entity;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
index 1ace20b..24ca836 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
@@ -28,7 +28,7 @@ public class ODataInlineEntitySet extends ODataLink {
private static final long serialVersionUID = -77628001615355449L;
- private ODataEntitySet entitySet;
+ private CommonODataEntitySet entitySet;
/**
* Constructor.
@@ -40,7 +40,7 @@ public class ODataInlineEntitySet extends ODataLink {
* @param entitySet entity set.
*/
public ODataInlineEntitySet(final ODataServiceVersion version, final URI uri, final ODataLinkType type,
- final String title, final ODataEntitySet entitySet) {
+ final String title, final CommonODataEntitySet entitySet) {
super(version, uri, type, title);
this.entitySet = entitySet;
@@ -57,7 +57,7 @@ public class ODataInlineEntitySet extends ODataLink {
* @param entitySet entity set.
*/
public ODataInlineEntitySet(final ODataServiceVersion version, final URI baseURI, final String href,
- final ODataLinkType type, final String title, final ODataEntitySet entitySet) {
+ final ODataLinkType type, final String title, final CommonODataEntitySet entitySet) {
super(version, baseURI, href, type, title);
this.entitySet = entitySet;
@@ -68,7 +68,7 @@ public class ODataInlineEntitySet extends ODataLink {
*
* @return wrapped entity set.
*/
- public ODataEntitySet getEntitySet() {
+ public CommonODataEntitySet getEntitySet() {
return entitySet;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
deleted file mode 100644
index 7114c5b..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
+++ /dev/null
@@ -1,210 +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.commons.api.domain;
-
-import java.net.URI;
-
-/**
- * Entry point for generating OData domain objects.
- */
-public interface ODataObjectFactory {
-
- /**
- * Instantiates a new entity set.
- *
- * @return entity set.
- */
- ODataEntitySet newEntitySet();
-
- /**
- * Instantiates a new entity set.
- *
- * @param next next link.
- * @return entity set.
- */
- ODataEntitySet newEntitySet(URI next);
-
- /**
- * Instantiates a new entity.
- *
- * @param name OData entity name.
- * @return entity.
- */
- ODataEntity newEntity(String name);
-
- /**
- * Instantiates a new entity.
- *
- * @param name OData entity name.
- * @param link self link.
- * @return entity.
- */
- ODataEntity newEntity(String name, URI link);
-
- /**
- * Instantiates a new in-line entity set.
- *
- * @param name name.
- * @param link edit link.
- * @param entitySet entity set.
- * @return in-line entity set.
- */
- ODataInlineEntitySet newInlineEntitySet(String name, URI link, ODataEntitySet entitySet);
-
- /**
- * Instantiates a new in-line entity set.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @param entitySet entity set.
- * @return in-line entity set.
- */
- ODataInlineEntitySet newInlineEntitySet(String name, URI baseURI, String href, ODataEntitySet entitySet);
-
- /**
- * Instantiates a new in-line entity.
- *
- * @param name name.
- * @param link edit link.
- * @param entity entity.
- * @return in-line entity.
- */
- ODataInlineEntity newInlineEntity(String name, URI link, ODataEntity entity);
-
- /**
- * Instantiates a new in-line entity.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @param entity entity.
- * @return in-line entity.
- */
- ODataInlineEntity newInlineEntity(String name, URI baseURI, String href, ODataEntity entity);
-
- /**
- * Instantiates a new entity navigation link.
- *
- * @param name name.
- * @param link link.
- * @return entity navigation link.
- */
- ODataLink newEntityNavigationLink(String name, URI link);
-
- /**
- * Instantiates a new entity navigation link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return entity navigation link.
- */
- ODataLink newEntityNavigationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new entity set navigation link.
- *
- * @param name name.
- * @param link link.
- * @return entity set navigation link.
- */
- ODataLink newFeedNavigationLink(String name, URI link);
-
- /**
- * Instantiates a new entity set navigation link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return entity set navigation link.
- */
- ODataLink newFeedNavigationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new association link.
- *
- * @param name name.
- * @param link link.
- * @return association link.
- */
- ODataLink newAssociationLink(String name, URI link);
-
- /**
- * Instantiates a new association link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return association link.
- */
- ODataLink newAssociationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new media-edit link.
- *
- * @param name name.
- * @param link link.
- * @return media-edit link.
- */
- ODataLink newMediaEditLink(String name, URI link);
-
- /**
- * Instantiates a new media-edit link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return media-edit link.
- */
- ODataLink newMediaEditLink(String name, URI baseURI, String href);
-
- ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
-
- ODataComplexValue newComplexValue(String typeName);
-
- ODataCollectionValue newCollectionValue(String typeName);
-
- /**
- * Instantiates a new primitive property.
- *
- * @param name name.
- * @param value primitive value.
- * @return primitive property.
- */
- ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
-
- /**
- * Instantiates a new complex property.
- *
- * @param name name.
- * @param value value.
- * @return complex property.
- */
- ODataProperty newComplexProperty(String name, ODataComplexValue value);
-
- /**
- * Instantiates a new collection property.
- *
- * @param name name.
- * @param value value.
- * @return collection property.
- */
- ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
deleted file mode 100644
index 4cfa303..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
+++ /dev/null
@@ -1,91 +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.commons.api.domain;
-
-import java.io.Serializable;
-
-/**
- * OData entity property.
- */
-public interface ODataProperty extends ODataInvokeResult, Serializable {
-
- /**
- * Returns property name.
- *
- * @return property name.
- */
- String getName();
-
- /**
- * Checks if has null value.
- *
- * @return 'TRUE' if has null value; 'FALSE' otherwise.
- */
- boolean hasNullValue();
-
- /**
- * Checks if has primitive value.
- *
- * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
- */
- boolean hasPrimitiveValue();
-
- /**
- * Gets primitive value.
- *
- * @return primitive value if exists; null otherwise.
- */
- ODataPrimitiveValue getPrimitiveValue();
-
- /**
- * Returns property value.
- *
- * @return property value.
- */
- ODataValue getValue();
-
- /**
- * Checks if has collection value.
- *
- * @return 'TRUE' if has collection value; 'FALSE' otherwise.
- */
- boolean hasCollectionValue();
-
- /**
- * Gets collection value.
- *
- * @return collection value if exists; null otherwise.
- */
- ODataCollectionValue getCollectionValue();
-
- /**
- * Checks if has complex value.
- *
- * @return 'TRUE' if has complex value; 'FALSE' otherwise.
- */
- boolean hasComplexValue();
-
- /**
- * Gets complex value.
- *
- * @return complex value if exists; null otherwise.
- */
- ODataComplexValue getComplexValue();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntity.java
new file mode 100644
index 0000000..18ba67b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntity.java
@@ -0,0 +1,32 @@
+/*
+ * 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.commons.api.domain.v3;
+
+import java.util.List;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+
+public interface ODataEntity extends CommonODataEntity {
+
+ @Override
+ ODataProperty getProperty(String name);
+
+ @Override
+ List<ODataProperty> getProperties();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntitySet.java
new file mode 100644
index 0000000..dae0919
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntitySet.java
@@ -0,0 +1,29 @@
+/*
+ * 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.commons.api.domain.v3;
+
+import java.util.List;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+
+public interface ODataEntitySet extends CommonODataEntitySet {
+
+ @Override
+ List<ODataEntity> getEntities();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
new file mode 100644
index 0000000..363f1de
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
@@ -0,0 +1,50 @@
+/*
+ * 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.commons.api.domain.v3;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+
+public interface ODataObjectFactory extends CommonODataObjectFactory {
+
+ @Override
+ ODataEntitySet newEntitySet();
+
+ @Override
+ ODataEntitySet newEntitySet(URI next);
+
+ @Override
+ ODataEntity newEntity(String name);
+
+ @Override
+ ODataEntity newEntity(String name, URI link);
+
+ @Override
+ ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
+
+ @Override
+ ODataProperty newComplexProperty(String name, ODataComplexValue value);
+
+ @Override
+ ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
new file mode 100644
index 0000000..266d53c
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
@@ -0,0 +1,25 @@
+/*
+ * 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.commons.api.domain.v3;
+
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+
+public interface ODataProperty extends CommonODataProperty {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
new file mode 100644
index 0000000..df9e801
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
@@ -0,0 +1,52 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import java.util.List;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+
+public interface ODataEntity extends CommonODataEntity {
+
+ @Override
+ ODataProperty getProperty(String name);
+
+ @Override
+ List<ODataProperty> getProperties();
+
+ /**
+ * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
+ * to the resource path.
+ * <br />
+ * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
+ * <br />
+ * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
+ * collection of entity references pointing to the related entities. If no entities are related, the response is the
+ * format-specific representation of an empty collection.
+ * <br />
+ * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
+ * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
+ * such entity exists, the service returns 404 Not Found.
+ *
+ * @return entity reference.
+ */
+ String getReference();
+
+ void setReference(String reference);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
new file mode 100644
index 0000000..97ac192
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
@@ -0,0 +1,29 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import java.util.List;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+
+public interface ODataEntitySet extends CommonODataEntitySet {
+
+ @Override
+ List<ODataEntity> getEntities();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEnumValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEnumValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEnumValue.java
new file mode 100644
index 0000000..2e3699d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEnumValue.java
@@ -0,0 +1,24 @@
+/*
+ * 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.commons.api.domain.v4;
+
+public interface ODataEnumValue extends ODataValue {
+
+ String getValue();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
new file mode 100644
index 0000000..8b43bc1
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+
+public interface ODataObjectFactory extends CommonODataObjectFactory {
+
+ @Override
+ ODataEntitySet newEntitySet();
+
+ @Override
+ ODataEntitySet newEntitySet(URI next);
+
+ @Override
+ ODataEntity newEntity(String name);
+
+ @Override
+ ODataEntity newEntity(String name, URI link);
+
+ @Override
+ ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
+
+ ODataProperty newEnumProperty(String name, ODataEnumValue value);
+
+ @Override
+ ODataProperty newComplexProperty(String name, ODataComplexValue value);
+
+ @Override
+ ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
new file mode 100644
index 0000000..61a8193
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
@@ -0,0 +1,38 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+
+public interface ODataProperty extends CommonODataProperty {
+
+ /**
+ * Checks if has enum value.
+ *
+ * @return 'TRUE' if has enum value; 'FALSE' otherwise.
+ */
+ boolean hasEnumValue();
+
+ /**
+ * Gets enum value.
+ *
+ * @return enum value if exists; null otherwise.
+ */
+ ODataEnumValue getEnumValue();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
new file mode 100644
index 0000000..1535e10
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
@@ -0,0 +1,36 @@
+/*
+ * 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.commons.api.domain.v4;
+
+public interface ODataValue extends org.apache.olingo.commons.api.domain.ODataValue {
+
+ /**
+ * Check is is an enum value.
+ *
+ * @return 'TRUE' if enum; 'FALSE' otherwise.
+ */
+ boolean isEnum();
+
+ /**
+ * Casts to enum value.
+ *
+ * @return enum value.
+ */
+ ODataEnumValue asEnum();
+}
[10/51] [abbrv] git commit: Redundant is redundant
Posted by sk...@apache.org.
Redundant is redundant
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a884ad12
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a884ad12
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a884ad12
Branch: refs/heads/olingo-206-validator
Commit: a884ad128d94e58d5657b9eb8bd24ffa1a44fc67
Parents: abe0e15
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 16:58:19 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 16:58:19 2014 +0100
----------------------------------------------------------------------
.../apache/olingo/client/core/uri/URIUtils.java | 38 ++++++++++----------
1 file changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a884ad12/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 4159e76..17cfcd0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -225,12 +225,12 @@ public final class URIUtils {
return version == ODataServiceVersion.V30
? prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
- valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTime)
: URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8);
+ valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8);
}
private static String calendar(final ODataServiceVersion version, final Calendar calendar)
@@ -241,8 +241,8 @@ public final class URIUtils {
if (version == ODataServiceVersion.V30) {
result = prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
- valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTime);
} else {
if (calendar.get(Calendar.YEAR) == 0 && calendar.get(Calendar.MONTH) == 0
@@ -260,8 +260,8 @@ public final class URIUtils {
} else {
result = prefix(version, EdmPrimitiveTypeKind.DateTimeOffset)
+ URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTimeOffset);
}
@@ -273,11 +273,11 @@ public final class URIUtils {
return version == ODataServiceVersion.V30
? EdmTime.getInstance().toUriLiteral(URLEncoder.encode(EdmTime.getInstance().
- valueToString(duration, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
: EdmDuration.getInstance().toUriLiteral(URLEncoder.encode(EdmDuration.getInstance().
- valueToString(duration, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
}
private static String quoteString(final String string, final boolean singleQuoteEscape)
@@ -339,7 +339,7 @@ public final class URIUtils {
value = buffer.toString();
} else {
value = (obj instanceof ParameterAlias)
- ? "@" + ((ParameterAlias) obj).getAlias().toString()
+ ? "@" + ((ParameterAlias) obj).getAlias()
: (obj instanceof Boolean)
? BooleanUtils.toStringTrueFalse((Boolean) obj)
: (obj instanceof UUID)
@@ -356,24 +356,24 @@ public final class URIUtils {
? duration(version, (Duration) obj)
: (obj instanceof BigDecimal)
? EdmDecimal.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Decimal)
: (obj instanceof Double)
? EdmDouble.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Double)
: (obj instanceof Float)
? EdmSingle.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Single)
: (obj instanceof Long)
? EdmInt64.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Int64)
: (obj instanceof Geospatial)
? URLEncoder.encode(EdmPrimitiveTypeFactory.getInstance(((Geospatial) obj).getEdmPrimitiveTypeKind()).
- valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
: (obj instanceof String)
? quoteString((String) obj, singleQuoteEscape)
: obj.toString();
[31/51] [abbrv] git commit: [OLINGO-227] fix minor xml issues
Posted by sk...@apache.org.
[OLINGO-227] fix minor xml issues
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/ac385b57
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/ac385b57
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/ac385b57
Branch: refs/heads/olingo-206-validator
Commit: ac385b571b1d8f880da562342e57c45b233f473e
Parents: d4c2484
Author: Stephan Klevenz <st...@sap.com>
Authored: Tue Apr 1 15:56:04 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Tue Apr 1 16:05:18 2014 +0200
----------------------------------------------------------------------
.../resources/v3/Car/filter/VIN add 5 lt 11.xml | 61 +++---
.../resources/v3/Car/filter/VIN div 2 le 8.xml | 23 +--
.../v3/Car/filter/VIN le 18 and VIN gt 12.xml | 23 +--
.../resources/v3/Car/filter/VIN mul 2 le 30.xml | 23 +--
.../filter/day(PurchaseDate) eq 15.xml | 23 +--
.../filter/hour(PurchaseDate) eq 1.xml | 23 +--
.../filter/minute(PurchaseDate) eq 33.xml | 23 +--
.../filter/month(PurchaseDate) eq 12.xml | 23 +--
.../filter/second(PurchaseDate) eq 35.xml | 23 +--
.../filter/year(PurchaseDate) eq 2020.xml | 23 +--
.../filter/isof(Name,'Edm.String') eq true.xml | 22 +--
.../resources/v3/InStreamErrorGetCustomer.xml | 197 ++++++++++++-------
pom.xml | 71 ++++---
13 files changed, 210 insertions(+), 348 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml b/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml
index 5b8c35b..ea2b814 100644
--- a/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml
+++ b/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml
@@ -1,41 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
-
--->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><author><name /></author></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
+ 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.
-->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
+ <id>http://localhost:x${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id>
+ <title type="text">Car</title>
+ <updated>2014-02-13T14:31:04Z</updated>
+ <link rel="self" title="Car" href="Car" />
+ <author>
+ <name />
+ </author>
+</feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml b/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml
index d771594..eda2ed0 100644
--- a/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml
+++ b/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(11)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(11)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-m
edia/Photo" title="Photo" href="Car(11)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(11)/Video" /><link rel="edit-media" title="Car" href="Car(11)/$value" /><content type="*/*" src="Car(11)/$value" /><m:properties><d:VIN m:type="Edm.Int32">11</d:VIN><d:Description>cenbviijieljtrtdslbuiqubcvhxhzenidqdnaopplvlqc</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(12)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(12)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(12)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href
="Car(12)/Video" /><link rel="edit-media" title="Car" href="Car(12)/$value" /><content type="*/*" src="Car(12)/$value" /><m:properties><d:VIN m:type="Edm.Int32">12</d:VIN><d:Description>lx</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="
true" /></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ�
��マび暦ダソク歹まあa裹ソハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30
/Static.svc/Car(16)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(16)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(16)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(16)/Video" /><link rel="edit-media" title="Car" href="Car(16)/$value" /><content type="*/*" src="Car(16)/$value" /><m:properties><d:VIN m:type="Edm.Int32">16</d:VIN><d:Description>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(17)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsof
t.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(17)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(17)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(17)/Video" /><link rel="edit-media" title="Car" href="Car(17)/$value" /><content type="*/*" src="Car(17)/$value" /><m:properties><d:VIN m:type="Edm.Int32">17</d:VIN><d:Description>まァチボЯ暦マチま匚ぁそタんゼびたチほ黑ポびぁソёん欲欲ヲをァァポぴグ亜チポグヲミそハせゼ珱ゼぜせポゼゼa裹黑そまそチ</d:Description></m:properties></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(11)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(11)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(11
)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(11)/Video" /><link rel="edit-media" title="Car" href="Car(11)/$value" /><content type="*/*" src="Car(11)/$value" /><m:properties><d:VIN m:type="Edm.Int32">11</d:VIN><d:Description>cenbviijieljtrtdslbuiqubcvhxhzenidqdnaopplvlqc</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(12)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(12)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(12)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(12)/Video" /><link rel="edit-med
ia" title="Car" href="Car(12)/$value" /><content type="*/*" src="Car(12)/$value" /><m:properties><d:VIN m:type="Edm.Int32">12</d:VIN><d:Description>lx</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="true" /></m:properties></entry><entry>
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ匚マび暦ダソク歹まあa裹ソ
ハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(16)</id><category term
="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(16)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(16)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(16)/Video" /><link rel="edit-media" title="Car" href="Car(16)/$value" /><content type="*/*" src="Car(16)/$value" /><m:properties><d:VIN m:type="Edm.Int32">16</d:VIN><d:Description>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(17)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"
/><link rel="edit" title="Car" href="Car(17)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(17)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(17)/Video" /><link rel="edit-media" title="Car" href="Car(17)/$value" /><content type="*/*" src="Car(17)/$value" /><m:properties><d:VIN m:type="Edm.Int32">17</d:VIN><d:Description>まァチボЯ暦マチま匚ぁそタんゼびたチほ黑ポびぁソёん欲欲ヲをァァポぴグ亜チポグヲミそハせゼ珱ゼぜせポゼゼa裹黑そまそチ</d:Description></m:properties></entry></feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml b/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml
index 471d9af..935391e 100644
--- a/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml
+++ b/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:06Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-m
edia/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="true" /></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" titl
e="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ匚マび暦ダソク歹まあa裹ソハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-medi
a/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(16)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(16)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(16)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(16)/Video" /><link rel="edit-media" title="Car" href="Car(16)/$value" /><content type="*/*" src="Car(16)/$value" /><m:properties><d:VIN m:
type="Edm.Int32">16</d:VIN><d:Description>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(17)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(17)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(17)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(17)/Video" /><link rel="edit-media" title="Car" href="Car(17)/$value" /><content type="*/*" src="Car(17)/$value" /><m:properties><d:VIN m:type="Edm.Int32">17</d:VIN><d:Description>まァチボЯ暦マチま匚ぁそタんゼびたチほ黑ポびぁソёん欲欲ヲ�
��ァァポぴグ亜チポグヲミそハせゼ珱ゼぜせポゼゼa裹黑そまそチ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(18)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(18)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(18)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(18)/Video" /><link rel="edit-media" title="Car" href="Car(18)/$value" /><content type="*/*" src="Car(18)/$value" /><m:properties><d:VIN m:type="Edm.Int32">18</d:VIN><d:Description>ёゼボタひべバタぞァяЯ畚ダソゾゾЯ歹ぺボぜたソ畚珱マ欲マグあ畚九ァ畚マグ
裹ミゼァ欲ソ弌畚マ弌チ暦ァボぜ裹ミЯaぼひポをゾ弌歹</d:Description></m:properties></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:06Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13
)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="true" /></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><conte
nt type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ匚マび暦ダソク歹まあa裹ソハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/V
ideo" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(16)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(16)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(16)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(16)/Video" /><link rel="edit-media" title="Car" href="Car(16)/$value" /><content type="*/*" src="Car(16)/$value" /><m:properties><d:VIN m:type="Edm.Int32">16</d:VIN><d:Descript
ion>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(17)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(17)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(17)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(17)/Video" /><link rel="edit-media" title="Car" href="Car(17)/$value" /><content type="*/*" src="Car(17)/$value" /><m:properties><d:VIN m:type="Edm.Int32">17</d:VIN><d:Description>まァチボЯ暦マチま匚ぁそタんゼびたチほ黑ポびぁソёん欲欲ヲをァァポぴグ亜チポグヲミそ
ハせゼ珱ゼぜせポゼゼa裹黑そまそチ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(18)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(18)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(18)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(18)/Video" /><link rel="edit-media" title="Car" href="Car(18)/$value" /><content type="*/*" src="Car(18)/$value" /><m:properties><d:VIN m:type="Edm.Int32">18</d:VIN><d:Description>ёゼボタひべバタぞァяЯ畚ダソゾゾЯ歹ぺボぜたソ畚珱マ欲マグあ畚九ァ畚マグ裹ミゼァ欲ソ弌畚マ弌チ暦�
�ボぜ裹ミЯaぼひポをゾ弌歹</d:Description></m:properties></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml b/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml
index 6fa295f..de88604 100644
--- a/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml
+++ b/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(11)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(11)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-m
edia/Photo" title="Photo" href="Car(11)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(11)/Video" /><link rel="edit-media" title="Car" href="Car(11)/$value" /><content type="*/*" src="Car(11)/$value" /><m:properties><d:VIN m:type="Edm.Int32">11</d:VIN><d:Description>cenbviijieljtrtdslbuiqubcvhxhzenidqdnaopplvlqc</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(12)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(12)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(12)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href
="Car(12)/Video" /><link rel="edit-media" title="Car" href="Car(12)/$value" /><content type="*/*" src="Car(12)/$value" /><m:properties><d:VIN m:type="Edm.Int32">12</d:VIN><d:Description>lx</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="
true" /></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ�
��マび暦ダソク歹まあa裹ソハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(11)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(11)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(11
)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(11)/Video" /><link rel="edit-media" title="Car" href="Car(11)/$value" /><content type="*/*" src="Car(11)/$value" /><m:properties><d:VIN m:type="Edm.Int32">11</d:VIN><d:Description>cenbviijieljtrtdslbuiqubcvhxhzenidqdnaopplvlqc</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(12)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(12)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(12)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(12)/Video" /><link rel="edit-med
ia" title="Car" href="Car(12)/$value" /><content type="*/*" src="Car(12)/$value" /><m:properties><d:VIN m:type="Edm.Int32">12</d:VIN><d:Description>lx</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="true" /></m:properties></entry><entry>
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ匚マび暦ダソク歹まあa裹ソ
ハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml b/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml
index e77bdfe..0ab5b04 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml b/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml
index cef8ad6..577a485 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml b/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml
index cef8ad6..577a485 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml b/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml
index 3d145e0..563fd3e 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry><entry><id>http://localhost:${ca
rgo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-1)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-1)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-1)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>mfhgyißxesckygsslbksqvcpohjienkcfbtrssp</uri><email>cybsycxhjrazcaxf</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-1)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties
><d:ComputerDetailId m:type="Edm.Int32">-1</d:ComputerDetailId><d:Manufacturer>cybsycxhjrazcaxf</d:Manufacturer><d:Model>mfhgyißxesckygsslbksqvcpohjienkcfbtrssp</d:Model><d:Serial>あァミゾダぜ裹あゼぞん匚畚バをミぼヲソン裹ぽハゾ黑ぼび</d:Serial><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>チ欲ァミ畚珱ボ欲をぴンたァ黑タァそクほァ黑ゼ畚グ弌亜ほチをaべあタ</d:element><d:element>タ縷ソ畚ボたひ暦裹ぞぽチグaぁァ亜チゼひzネaぜボёタグネ黑バタびチ弌ほ黑グマ亜ぼあソポゾポべク畚畚をヲグチЯチzァほチボ匚欲ンタミゼ弌ぞ欲ゼゼ畚ポ裹縷ゾぼバヲ歹ひゾそボポひボチほまハぞそたソ</d:element><d:element>udjcekzitroessd</d:element><d:element>shxnubznxdumkraixsjsskrspkss</d:element><d:element>vugqblidbkbfkppfbbkanvnflueqdousryyhhucoxtpbbnyeecbsauzaceu</d:element><d:element>aerlqnsczhßgivchizyapazitnsszugryqlupnußjgxg</d:element>
<d:element>あべ暦裹zぽタゾ歹яひチミせチ亜あチ九ぞミボёボ暦ァ黑ソポ匚ポあァせソ亜ぞぼゼグァたボ九ゼネя裹歹バ亜亜ぜバaソびひせバァあ歹あァぜ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">9999-12-31T23:59:59.9999999</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-69.6411071913679</d:Width><d:Height m:type="Edm.Decimal">1451.59900018645</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/St
atic.svc/ComputerDetail(-1)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-1)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-1)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>mfhgyißxesckygsslbksqvcpohjienkcfbtrssp</uri><email>cybsycxhjrazcaxf</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-1)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32
">-1</d:ComputerDetailId><d:Manufacturer>cybsycxhjrazcaxf</d:Manufacturer><d:Model>mfhgyißxesckygsslbksqvcpohjienkcfbtrssp</d:Model><d:Serial>あァミゾダぜ裹あゼぞん匚畚バをミぼヲソン裹ぽハゾ黑ぼび</d:Serial><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>チ欲ァミ畚珱ボ欲をぴンたァ黑タァそクほァ黑ゼ畚グ弌亜ほチをaべあタ</d:element><d:element>タ縷ソ畚ボたひ暦裹ぞぽチグaぁァ亜チゼひzネaぜボёタグネ黑バタびチ弌ほ黑グマ亜ぼあソポゾポべク畚畚をヲグチЯチzァほチボ匚欲ンタミゼ弌ぞ欲ゼゼ畚ポ裹縷ゾぼバヲ歹ひゾそボポひボチほまハぞそたソ</d:element><d:element>udjcekzitroessd</d:element><d:element>shxnubznxdumkraixsjsskrspkss</d:element><d:element>vugqblidbkbfkppfbbkanvnflueqdousryyhhucoxtpbbnyeecbsauzaceu</d:element><d:element>aerlqnsczhßgivchizyapazitnsszugryqlupnußjgxg</d:element><d:element>あべ暦裹zぽタゾ歹
яひチミせチ亜あチ九ぞミボёボ暦ァ黑ソポ匚ポあァせソ亜ぞぼゼグァたボ九ゼネя裹歹バ亜亜ぜバaソびひせバァあ歹あァぜ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">9999-12-31T23:59:59.9999999</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-69.6411071913679</d:Width><d:Height m:type="Edm.Decimal">1451.59900018645</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml b/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml
index cef8ad6..577a485 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
[51/51] [abbrv] git commit: [OLINGO-206] Merge remote-tracking branch
'origin/master' into olingo-206-val
Posted by sk...@apache.org.
[OLINGO-206] Merge remote-tracking branch 'origin/master' into olingo-206-val
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/6d66ff39
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/6d66ff39
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/6d66ff39
Branch: refs/heads/olingo-206-validator
Commit: 6d66ff3912717ca0a0be1430f8fea6dff149066d
Parents: 49e1069 2517423
Author: Stephan Klevenz <st...@sap.com>
Authored: Thu Apr 3 17:54:51 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Thu Apr 3 17:54:51 2014 +0200
----------------------------------------------------------------------
fit/pom.xml | 18 -
.../org/apache/olingo/fit/AbstractServices.java | 14 +-
.../java/org/apache/olingo/fit/V3Services.java | 31 ++
fit/src/main/resources/v3/openTypeMetadata.xml | 67 ++++
.../olingo/client/api/op/v4/ODataBinder.java | 2 +
.../communication/request/ODataRequestImpl.java | 4 +-
.../edm/AbstractEdmServiceMetadataImpl.java | 2 +-
.../olingo/client/core/edm/EdmClientImpl.java | 4 +-
.../client/core/edm/EdmComplexTypeImpl.java | 5 +
.../client/core/edm/EdmEntityContainerImpl.java | 13 +-
.../client/core/edm/EdmEntityTypeImpl.java | 5 +
.../olingo/client/core/edm/EdmSchemaImpl.java | 51 ++-
.../core/edm/EdmStructuredTypeHelperImpl.java | 11 +
.../AbstractBasicAuthHttpClientFactory.java | 51 ---
.../http/AbstractNTLMAuthHttpClientFactory.java | 63 ----
.../core/http/BasicAuthHttpClientFactory.java | 55 +++
.../core/http/NTLMAuthHttpClientFactory.java | 73 ++++
.../http/ProxyWrapperHttpClientFactory.java | 86 +++++
.../client/core/op/AbstractODataBinder.java | 127 +++----
.../client/core/op/impl/v3/ODataBinderImpl.java | 10 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 53 ++-
.../apache/olingo/client/core/uri/URIUtils.java | 21 +-
.../client/core/it/v3/AbstractTestITCase.java | 6 +-
.../it/v3/AuthEntityRetrieveTestITCase.java | 16 +-
.../client/core/it/v3/OpenTypeTestITCase.java | 17 +-
.../olingo/client/core/v4/EntityTest.java | 28 ++
.../apache/olingo/client/core/v4/JSONTest.java | 5 +-
.../olingo/client/core/v4/atom_cleanup.xsl | 3 +-
.../olingo/client/core/v4/entity.full.json | 22 --
.../core/v4/entity.withcomplexnavigation.json | 22 ++
.../core/v4/entity.withcomplexnavigation.xml | 62 ++++
.../apache/olingo/commons/api/data/Entry.java | 16 +-
.../apache/olingo/commons/api/data/Linked.java | 38 +++
.../commons/api/data/LinkedComplexValue.java | 24 ++
.../apache/olingo/commons/api/data/Value.java | 4 +
.../commons/api/domain/CommonODataEntity.java | 76 +----
.../olingo/commons/api/domain/ODataLinked.java | 70 ++++
.../api/domain/v4/ODataLinkedComplexValue.java | 26 ++
.../api/domain/v4/ODataObjectFactory.java | 2 +
.../commons/api/domain/v4/ODataProperty.java | 7 +
.../commons/api/domain/v4/ODataValue.java | 14 +
.../commons/api/edm/EdmEntityContainer.java | 23 +-
.../olingo/commons/api/edm/EdmEntityType.java | 4 +-
.../olingo/commons/api/edm/EdmSchema.java | 36 +-
.../commons/api/edm/EdmStructuredType.java | 7 +
.../commons/core/data/AbstractAtomDealer.java | 2 +-
.../core/data/AbstractJsonDeserializer.java | 111 ++++++-
.../core/data/AbstractJsonSerializer.java | 57 ++++
.../olingo/commons/core/data/AbstractValue.java | 11 +
.../commons/core/data/AtomDeserializer.java | 245 +++++++++++++-
.../core/data/AtomPropertyDeserializer.java | 240 -------------
.../core/data/AtomPropertySerializer.java | 116 -------
.../commons/core/data/AtomSerializer.java | 92 ++++-
.../core/data/JSONEntryDeserializer.java | 74 +----
.../commons/core/data/JSONEntrySerializer.java | 56 +---
.../core/data/JSONPropertyDeserializer.java | 2 +-
.../core/data/LinkedComplexValueImpl.java | 47 +++
.../domain/v4/ODataCollectionValueImpl.java | 11 +
.../core/domain/v4/ODataComplexValueImpl.java | 86 ++++-
.../core/domain/v4/ODataEnumValueImpl.java | 10 +
.../core/domain/v4/ODataObjectFactoryImpl.java | 6 +
.../core/domain/v4/ODataPrimitiveValueImpl.java | 11 +
.../core/domain/v4/ODataPropertyImpl.java | 16 +-
.../olingo/commons/core/edm/AbstractEdm.java | 333 +++++++++++++++++++
.../core/edm/AbstractEdmComplexType.java | 63 ++--
.../core/edm/AbstractEdmEntityContainer.java | 16 +-
.../commons/core/edm/AbstractEdmEntityType.java | 13 +-
.../commons/core/edm/AbstractEdmImpl.java | 333 -------------------
.../core/edm/AbstractEdmNavigationProperty.java | 17 +-
.../commons/core/edm/AbstractEdmSchema.java | 154 +++++++++
.../commons/core/edm/AbstractEdmSchemaImpl.java | 128 -------
.../core/edm/AbstractEdmStructuredType.java | 184 +++++-----
.../core/edm/EdmStructuredTypeHelper.java | 3 +
.../olingo/commons/core/edm/EdmTypeImpl.java | 45 ++-
.../commons/core/edm/EdmImplCachingTest.java | 4 +-
.../commons/core/edm/EdmImplCallCreateTest.java | 4 +-
.../core/edm/provider/EdmComplexTypeImpl.java | 9 +-
.../core/edm/provider/EdmEntityTypeImpl.java | 54 +--
.../core/edm/provider/EdmProviderImpl.java | 4 +-
.../server/core/edm/provider/EdmSchemaImpl.java | 4 +-
.../provider/EdmStructuredTypeHelperImpl.java | 8 +-
.../edm/provider/EdmComplexTypeImplTest.java | 12 +-
.../edm/provider/EdmEntityTypeImplTest.java | 11 +-
.../core/edm/provider/EdmSchemaImplTest.java | 6 +-
.../serializer/xml/MetadataDocumentTest.java | 197 ++++++++++-
pom.xml | 2 +-
86 files changed, 2559 insertions(+), 1532 deletions(-)
----------------------------------------------------------------------
[02/51] [abbrv] git commit: [OLINGO-200] Introducing interfaces for
domain object
Posted by sk...@apache.org.
[OLINGO-200] Introducing interfaces for domain object
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/ceda4740
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/ceda4740
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/ceda4740
Branch: refs/heads/olingo-206-validator
Commit: ceda474058f1f7c369ee6f4b52157ee7464aa16c
Parents: e0d1b6f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 14:48:17 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 14:48:17 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonODataClient.java | 3 -
.../olingo/client/core/AbstractODataClient.java | 8 +-
.../client/core/op/AbstractODataBinder.java | 17 +-
.../client/core/op/AbstractODataReader.java | 4 +-
.../client/core/it/AbstractTestITCase.java | 35 +-
.../client/core/it/v3/AsyncTestITCase.java | 2 +-
.../core/it/v3/EntityCreateTestITCase.java | 22 +-
.../core/it/v3/EntityUpdateTestITCase.java | 2 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 43 ++-
.../client/core/it/v3/OpenTypeTestITCase.java | 65 ++--
.../client/core/it/v3/PropertyTestITCase.java | 10 +-
.../client/core/v3/PrimitiveValueTest.java | 62 ++--
.../olingo/client/core/v3/PropertyTest.java | 10 +-
.../client/core/v4/PrimitiveValueTest.java | 4 +-
.../commons/api/domain/AbstractODataValue.java | 14 +
.../api/domain/ODataCollectionValue.java | 64 +---
.../commons/api/domain/ODataComplexValue.java | 59 +--
.../olingo/commons/api/domain/ODataEntity.java | 240 +++---------
.../commons/api/domain/ODataEntitySet.java | 81 +---
.../commons/api/domain/ODataObjectFactory.java | 11 +-
.../commons/api/domain/ODataProperty.java | 104 +-----
.../olingo/commons/api/domain/ODataValue.java | 7 +
.../core/domain/ODataCollectionValueImpl.java | 90 +++++
.../core/domain/ODataComplexValueImpl.java | 89 +++++
.../commons/core/domain/ODataEntityImpl.java | 372 +++++++++++++++++++
.../commons/core/domain/ODataEntitySetImpl.java | 104 ++++++
.../core/domain/ODataObjectFactoryImpl.java | 171 +++++++++
.../core/domain/ODataPrimitiveValueImpl.java | 9 +
.../commons/core/domain/ODataPropertyImpl.java | 172 +++++++++
.../commons/core/op/ODataObjectFactoryImpl.java | 156 --------
30 files changed, 1269 insertions(+), 761 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index e811744..af904b3 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.communication.request.retrieve.CommonRetriev
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
import org.apache.olingo.client.api.op.ClientODataDeserializer;
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.api.op.CommonODataReader;
import org.apache.olingo.commons.api.op.ODataSerializer;
@@ -47,8 +46,6 @@ public interface CommonODataClient {
CommonFilterFactory getFilterFactory();
- ODataPrimitiveValue.Builder getPrimitiveValueBuilder();
-
ODataSerializer getSerializer();
ClientODataDeserializer getDeserializer();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 80c8d16..405f95d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -21,8 +21,7 @@ package org.apache.olingo.client.core;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.op.ODataWriter;
-import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
-import org.apache.olingo.commons.core.op.ODataObjectFactoryImpl;
+import org.apache.olingo.commons.core.domain.ODataObjectFactoryImpl;
import org.apache.olingo.client.core.op.ODataWriterImpl;
public abstract class AbstractODataClient implements CommonODataClient {
@@ -34,11 +33,6 @@ public abstract class AbstractODataClient implements CommonODataClient {
private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
@Override
- public ODataPrimitiveValueImpl.BuilderImpl getPrimitiveValueBuilder() {
- return new ODataPrimitiveValueImpl.BuilderImpl(this.getServiceVersion());
- }
-
- @Override
public ODataWriter getWriter() {
return writer;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 36ff32b..2a0ea4f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -42,6 +42,7 @@ import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.core.domain.ODataPropertyImpl;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -220,9 +221,9 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (property.hasPrimitiveValue()) {
propertyResource.setType(property.getPrimitiveValue().getType().toString());
} else if (property.hasComplexValue()) {
- propertyResource.setType(property.getComplexValue().getType());
+ propertyResource.setType(property.getComplexValue().getTypeName());
} else if (property.hasCollectionValue()) {
- propertyResource.setType(property.getCollectionValue().getType());
+ propertyResource.setType(property.getCollectionValue().getTypeName());
}
}
@@ -284,7 +285,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
for (Entry entryResource : resource.getEntries()) {
- entitySet.addEntity(getODataEntity(entryResource));
+ entitySet.getEntities().add(getODataEntity(entryResource));
}
return entitySet;
@@ -369,20 +370,20 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
@Override
public ODataProperty getODataProperty(final Property property) {
- return new ODataProperty(property.getName(), getODataValue(property));
+ return new ODataPropertyImpl(property.getName(), getODataValue(property));
}
private ODataValue getODataValue(final Property resource) {
ODataValue value = null;
if (resource.getValue().isPrimitive()) {
- value = client.getPrimitiveValueBuilder().
+ value = client.getObjectFactory().newPrimitiveValueBuilder().
setText(resource.getValue().asPrimitive().get()).
setType(resource.getType() == null
? null
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isGeospatial()) {
- value = client.getPrimitiveValueBuilder().
+ value = client.getObjectFactory().newPrimitiveValueBuilder().
setValue(resource.getValue().asGeospatial().get()).
setType(resource.getType() == null
|| EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
@@ -390,13 +391,13 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isComplex()) {
- value = new ODataComplexValue(resource.getType());
+ value = client.getObjectFactory().newComplexValue(resource.getType());
for (Property property : resource.getValue().asComplex().get()) {
value.asComplex().add(getODataProperty(property));
}
} else if (resource.getValue().isCollection()) {
- value = new ODataCollectionValue(resource.getType());
+ value = client.getObjectFactory().newCollectionValue(resource.getType());
for (Value _value : resource.getValue().asCollection().get()) {
final JSONPropertyImpl fake = new JSONPropertyImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index ffc58e1..f21f16a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -126,9 +126,9 @@ public abstract class AbstractODataReader implements CommonODataReader {
container.getMetadataETag(),
(T) client.getBinder().getODataProperty(container.getObject()));
} else if (ODataValue.class.isAssignableFrom(reference)) {
- res = new Container<T>(null, null, (T) client.getPrimitiveValueBuilder().
+ res = new Container<T>(null, null, (T) client.getObjectFactory().newPrimitiveValueBuilder().
setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
- ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
+ ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(src)).
build());
} else if (XMLMetadata.class.isAssignableFrom(reference)) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 73e6f2b..bba68de 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -213,8 +213,8 @@ public abstract class AbstractTestITCase {
entity.setMediaEntity(true);
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information",
- getClient().getPrimitiveValueBuilder().setText(sampleinfo).setType(
- EdmPrimitiveTypeKind.String).build()));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).setType(
+ EdmPrimitiveTypeKind.String).build()));
return entity;
}
@@ -227,45 +227,48 @@ public abstract class AbstractTestITCase {
// add name attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
- getClient().getPrimitiveValueBuilder().setText(sampleName).setType(
- EdmPrimitiveTypeKind.String).build()));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).setType(
+ EdmPrimitiveTypeKind.String).build()));
// add key attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
- getClient().getPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
- EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
+ EdmPrimitiveTypeKind.Int32).build()));
// add BackupContactInfo attribute (collection)
- final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
+ final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
entity.getProperties().add(getClient().getObjectFactory().newCollectionProperty("BackupContactInfo",
backupContactInfoValue));
// add BackupContactInfo.ContactDetails attribute (complex)
- final ODataComplexValue contactDetails = new ODataComplexValue(
+ final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
backupContactInfoValue.add(contactDetails);
// add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
- final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
- altNamesValue.add(getClient().getPrimitiveValueBuilder().
+ final ODataCollectionValue altNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ altNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setText("myname").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
// add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
- final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
- emailBagValue.add(getClient().getPrimitiveValueBuilder().
+ final ODataCollectionValue emailBagValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ emailBagValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
// add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
- final ODataComplexValue contactAliasValue = new ODataComplexValue(
+ final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
contactDetails.add(getClient().getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
// add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
- final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
- aliasAltNamesValue.add(getClient().getPrimitiveValueBuilder().
+ final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ aliasAltNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
@@ -511,7 +514,7 @@ public abstract class AbstractTestITCase {
assertNotEquals(newm, oldm);
changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty(propertyName,
- getClient().getPrimitiveValueBuilder().setText(newm).build()));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
update(type, changes, format, etag);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 8b7fa01..b77ebf8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -75,7 +75,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
entity.getProperties().remove(entity.getProperty("Description"));
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Description",
- client.getPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
final ODataEntityUpdateRequest updateReq =
client.getCUDRequestFactory().getEntityUpdateRequest(uri, UpdateType.MERGE, entity);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 6e4484c..1ebe190 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -291,10 +291,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
.build()));
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
.build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
@@ -388,9 +388,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
ODataEntity order = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
order.addLink(client.getObjectFactory().newEntityNavigationLink(
"Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString())));
@@ -446,22 +448,22 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
"Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("MessageId",
- client.getPrimitiveValueBuilder().setValue(1000).
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(1000).
setType(EdmPrimitiveTypeKind.Int32).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FromUsername",
- client.getPrimitiveValueBuilder().setValue("1").
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("1").
setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("ToUsername",
- client.getPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Subject",
- client.getPrimitiveValueBuilder().setValue("Test subject").
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test subject").
setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Body",
- client.getPrimitiveValueBuilder().setValue("Test body").
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test body").
setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
- client.getPrimitiveValueBuilder().setValue(false).
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(false).
setType(EdmPrimitiveTypeKind.Boolean).build()));
final CommonURIBuilder<?> builder =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 40afeac..fed9ba4 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -186,7 +186,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final boolean before = message.getProperty("IsRead").getPrimitiveValue().toCastValue(Boolean.class);
message.getProperties().remove(message.getProperty("IsRead"));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
- client.getPrimitiveValueBuilder().setValue(!before).
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(!before).
setType(EdmPrimitiveTypeKind.Boolean).build()));
return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index b1e385d..5cc8770 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -210,9 +210,11 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
@@ -268,48 +270,50 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// add name attribute
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
- client.getPrimitiveValueBuilder().setText(name).setType(EdmPrimitiveTypeKind.String).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(name).
+ setType(EdmPrimitiveTypeKind.String).build()));
// add key attribute
if (id != 0) {
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setText(String.valueOf(id)).
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
setType(EdmPrimitiveTypeKind.Int32).build()));
}
- final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
+ final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
-
- final ODataComplexValue contactDetails = new ODataComplexValue(
+ final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
-
- final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
- altNamesValue.add(client.getPrimitiveValueBuilder().
+ final ODataCollectionValue altNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ altNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
- final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
- emailBagValue.add(client.getPrimitiveValueBuilder().
+ final ODataCollectionValue emailBagValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ emailBagValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
- final ODataComplexValue contactAliasValue = new ODataComplexValue(
+ final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
contactDetails.add(client.getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
- final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
- aliasAltNamesValue.add(client.getPrimitiveValueBuilder().
+ final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ aliasAltNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
- final ODataComplexValue homePhone = new ODataComplexValue(
+ final ODataComplexValue homePhone = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
- client.getPrimitiveValueBuilder().setText("8437568356834568").
+ client.getObjectFactory().newPrimitiveValueBuilder().setText("8437568356834568").
setType(EdmPrimitiveTypeKind.String).build()));
homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension",
- client.getPrimitiveValueBuilder().setText("124365426534621534423ttrf").
+ client.getObjectFactory().newPrimitiveValueBuilder().setText("124365426534621534423ttrf").
setType(EdmPrimitiveTypeKind.String).
build()));
contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
@@ -373,7 +377,8 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
entity.setMediaEntity(true);
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
- client.getPrimitiveValueBuilder().setText(info).setType(EdmPrimitiveTypeKind.String).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(info).
+ setType(EdmPrimitiveTypeKind.String).build()));
return entity;
}
// validate newly created entities
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index bb507e4..d00bf8b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -93,50 +93,57 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Id",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aString",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).setValue("string").
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.String).setValue("string").
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aBoolean",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLong",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDouble",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aByte",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDate",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
build()));
final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
point.setX(1.2);
point.setY(2.1);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPoint",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(point).build()));
final List<Point> points = new ArrayList<Point>();
points.add(point);
points.add(point);
final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
setValue(multipoint).build()));
final LineString lineString = new LineString(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLineString",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
setValue(lineString).build()));
final List<LineString> lineStrings = new ArrayList<LineString>();
lineStrings.add(lineString);
lineStrings.add(lineString);
final MultiLineString multiLineString = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, null, lineStrings);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(multiLineString).build()));
final Point otherPoint = new Point(Geospatial.Dimension.GEOGRAPHY, null);
otherPoint.setX(3.4);
@@ -146,14 +153,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
points.add(point);
final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, points, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPolygon",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(polygon).build()));
final List<Polygon> polygons = new ArrayList<Polygon>();
polygons.add(polygon);
polygons.add(polygon);
final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, null, polygons);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
setValue(multiPolygon).build()));
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
geospatials.add(otherPoint);
@@ -162,46 +169,46 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
geospatials.add(multiPolygon);
final GeospatialCollection geoColl = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, geospatials);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aCollection",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(geoColl).build()));
- final ODataComplexValue contactDetails =
- new ODataComplexValue("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
+ final ODataComplexValue contactDetails = client.getObjectFactory().newComplexValue(
+ "Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("FirstContacted",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Binary).setValue("text".getBytes()).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("LastContacted",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("2001-04-05T05:05:05.001+00:01").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Contacted",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTime).setText("2001-04-05T05:05:04.001").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("GUID",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Guid).setValue(UUID.randomUUID()).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("PreferedContactTime",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Time).setText("-P9DT51M10.5063807S").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Byte",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Byte).setValue(Integer.valueOf(241)).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("SignedByte",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Double",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Double).setValue(Double.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Single",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Single).setValue(Float.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Short",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Int16).setValue(Short.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Int",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Int32).setValue(Integer.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Long",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Int64).setValue(Long.MAX_VALUE).build()));
row.getProperties().add(client.getObjectFactory().newComplexProperty("aContact", contactDetails));
@@ -243,7 +250,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
assertEquals(EdmPrimitiveTypeKind.GeographyCollection,
row.getProperty("aCollection").getPrimitiveValue().getTypeKind());
assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails",
- row.getProperty("aContact").getComplexValue().getType());
+ row.getProperty("aContact").getComplexValue().getTypeName());
assertEquals(EdmPrimitiveTypeKind.SByte,
row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeKind());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index 93384bb..ddcd75f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -181,7 +181,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
assertNotEquals(newMsg, oldMsg);
- final ODataPrimitiveValue newVal = client.getPrimitiveValueBuilder().setText(newMsg).build();
+ final ODataPrimitiveValue newVal = client.getObjectFactory().newPrimitiveValueBuilder().setText(newMsg).build();
final ODataValueUpdateRequest updateReq =
client.getCUDRequestFactory().getValueUpdateRequest(uriBuilder.build(), type, newVal);
@@ -222,7 +222,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final int origSize = originalValue.size();
- originalValue.add(client.getPrimitiveValueBuilder().setText(newItem).build());
+ originalValue.add(client.getObjectFactory().newPrimitiveValueBuilder().setText(newItem).build());
assertEquals(origSize + 1, originalValue.size());
final ODataPropertyUpdateRequest updateReq = client.getCUDRequestFactory().
@@ -268,12 +268,12 @@ public class PropertyTestITCase extends AbstractTestITCase {
final int origSize = originalValue.size();
- originalValue.add(client.getPrimitiveValueBuilder().setText(newItem).build());
+ originalValue.add(client.getObjectFactory().newPrimitiveValueBuilder().setText(newItem).build());
assertEquals(origSize + 1, originalValue.size());
final ODataPropertyUpdateRequest updateReq =
client.getCUDRequestFactory().getPropertyCollectionValueUpdateRequest(uriBuilder.build(),
- alternativeNames);
+ alternativeNames);
if (client.getConfiguration().isUseXHTTPMethod()) {
assertEquals(HttpMethod.POST, updateReq.getMethod());
} else {
@@ -315,7 +315,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
assertNotEquals(newMsg, oldMsg);
phoneNumber = client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
- client.getPrimitiveValueBuilder().setText(newMsg).build());
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(newMsg).build());
final ODataPropertyUpdateRequest updateReq =
client.getCUDRequestFactory().getPropertyPrimitiveValueUpdateRequest(uriBuilder.build(), phoneNumber);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/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 04f392a..64301df 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
@@ -57,24 +57,25 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageInt32() throws EdmPrimitiveTypeException {
final int primitive = -10;
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Int32, value.asPrimitive().getTypeKind());
assertEquals(Integer.valueOf(primitive), value.asPrimitive().toCastValue(Integer.class));
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
assertEquals("9", value.asPrimitive().toCastValue(Integer.class).toString());
}
@Test
public void manageString() throws EdmPrimitiveTypeException {
final String primitive = UUID.randomUUID().toString();
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText(primitive).build();
assertEquals(EdmPrimitiveTypeKind.String, value.asPrimitive().getTypeKind());
assertEquals(primitive, value.toString());
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue(String.class).toString());
}
@@ -82,12 +83,12 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageDecimal() throws EdmPrimitiveTypeException {
final BigDecimal primitive = new BigDecimal("-79228162514264337593543950335");
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Decimal, value.asPrimitive().getTypeKind());
assertEquals(primitive, value.asPrimitive().toCastValue(BigDecimal.class));
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setText("-79228162514264337593543950335").build();
assertEquals("-79228162514264337593543950335", value.asPrimitive().toCastValue(BigDecimal.class).toString());
}
@@ -99,7 +100,7 @@ public class PrimitiveValueTest extends AbstractTest {
expected.set(2013, 0, 10, 2, 0, 0);
expected.set(Calendar.MILLISECOND, 1667673);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTime).setValue(expected).build();
assertEquals(EdmPrimitiveTypeKind.DateTime, value.asPrimitive().getTypeKind());
@@ -123,7 +124,7 @@ public class PrimitiveValueTest extends AbstractTest {
public void manageTime() throws EdmPrimitiveTypeException {
final String primitive = "-P9DT51M10.5063807S";
final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
setText(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Time, value.asPrimitive().getTypeKind());
// performed cast to improve the check
@@ -137,7 +138,7 @@ public class PrimitiveValueTest extends AbstractTest {
expected.setTimeZone(TimeZone.getTimeZone("GMT"));
expected.set(2013, 0, 10, 2, 0, 0);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(expected).build();
assertEquals(EdmPrimitiveTypeKind.DateTimeOffset, value.asPrimitive().getTypeKind());
@@ -155,12 +156,12 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageGuid() throws EdmPrimitiveTypeException {
final UUID primitive = UUID.fromString("1126a28b-a4af-4bbd-bf0a-2b2c22635565");
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Guid, value.asPrimitive().getTypeKind());
assertEquals(primitive, value.asPrimitive().toCastValue(UUID.class));
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue(UUID.class).toString());
}
@@ -168,14 +169,15 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageBinary() throws EdmPrimitiveTypeException {
final byte[] primitive = UUID.randomUUID().toString().getBytes();
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Binary, value.asPrimitive().getTypeKind());
assertEquals(
Base64.encodeBase64String(primitive),
Base64.encodeBase64String(value.asPrimitive().toCastValue(byte[].class)));
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Binary).
setText(Base64.encodeBase64String("primitive".getBytes())).build();
assertEquals("primitive", new String(value.asPrimitive().toCastValue(byte[].class)));
}
@@ -186,8 +188,8 @@ public class PrimitiveValueTest extends AbstractTest {
primitive.setX(52.8606);
primitive.setY(173.334);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(primitive).
build();
assertEquals(EdmPrimitiveTypeKind.GeographyPoint, value.asPrimitive().getTypeKind());
@@ -222,8 +224,9 @@ public class PrimitiveValueTest extends AbstractTest {
final LineString primitive = new LineString(Geospatial.Dimension.GEOGRAPHY, null, points);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build();
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyLineString).
+ setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeographyLineString, value.asPrimitive().getTypeKind());
final Iterator<Point> iter = value.asPrimitive().toCastValue(LineString.class).iterator();
@@ -247,8 +250,9 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPoint primitive = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build();
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
+ setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint, value.asPrimitive().getTypeKind());
final Iterator<Point> iter = value.asPrimitive().toCastValue(MultiPoint.class).iterator();
@@ -307,8 +311,8 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiLineString primitive = new MultiLineString(Geospatial.Dimension.GEOMETRY, null, lines);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString, value.asPrimitive().getTypeKind());
@@ -360,8 +364,8 @@ public class PrimitiveValueTest extends AbstractTest {
final Polygon primitive = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, interior, exterior);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeographyPolygon, value.asPrimitive().getTypeKind());
@@ -466,8 +470,8 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPolygon primitive = new MultiPolygon(Geospatial.Dimension.GEOMETRY, null, polygons);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon, value.asPrimitive().getTypeKind());
@@ -512,8 +516,8 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOMETRY, null, collection);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryCollection).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeometryCollection, value.asPrimitive().getTypeKind());
@@ -544,8 +548,8 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, collection);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeographyCollection, value.asPrimitive().getTypeKind());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 597e235..6d46398 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -49,7 +49,7 @@ public class PropertyTest extends AbstractTest {
public void readPropertyValue() throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId_value.txt");
- final ODataPrimitiveValue value = getClient().getPrimitiveValueBuilder().
+ final ODataPrimitiveValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.String).
setText(IOUtils.toString(input)).
build();
@@ -71,7 +71,7 @@ public class PropertyTest extends AbstractTest {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
+ final ODataPrimitiveValue typedValue = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(property.getPrimitiveValue().getTypeKind()).
setText(written.getPrimitiveValue().toString()).
build();
@@ -107,7 +107,8 @@ public class PropertyTest extends AbstractTest {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataComplexValue typedValue = new ODataComplexValue(property.getComplexValue().getType());
+ final ODataComplexValue typedValue = getClient().getObjectFactory().
+ newComplexValue(property.getComplexValue().getTypeName());
for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
final ODataProperty prop = itor.next();
typedValue.add(prop);
@@ -144,7 +145,8 @@ public class PropertyTest extends AbstractTest {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataCollectionValue typedValue = new ODataCollectionValue(property.getCollectionValue().getType());
+ final ODataCollectionValue typedValue = getClient().getObjectFactory().
+ newCollectionValue(property.getCollectionValue().getTypeName());
for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
final ODataValue value = itor.next();
typedValue.add(value);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index 0fc9b18..e61a9df 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -41,7 +41,7 @@ public class PrimitiveValueTest extends AbstractTest {
expected.clear();
expected.set(2013, 0, 10, 21, 45, 17);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(expected).build();
assertEquals(EdmPrimitiveTypeKind.TimeOfDay, value.asPrimitive().getTypeKind());
@@ -59,7 +59,7 @@ public class PrimitiveValueTest extends AbstractTest {
expected.clear();
expected.set(2013, 0, 10);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Date).setValue(expected).build();
assertEquals(EdmPrimitiveTypeKind.Date, value.asPrimitive().getTypeKind());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
index 3eb664b..1dbfdf8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
@@ -31,6 +31,20 @@ public abstract class AbstractODataValue implements ODataValue {
private static final long serialVersionUID = 7445422004232581877L;
/**
+ * Type name;
+ */
+ private final String typeName;
+
+ public AbstractODataValue(String typeName) {
+ this.typeName = typeName;
+ }
+
+ @Override
+ public String getTypeName() {
+ return typeName;
+ }
+
+ /**
* Check is is a primitive value.
*
* @return 'TRUE' if primitive; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
index f583187..d0daf59 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
@@ -18,81 +18,29 @@
*/
package org.apache.olingo.commons.api.domain;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
/**
* OData collection property value.
*/
-public class ODataCollectionValue extends AbstractODataValue implements Iterable<ODataValue> {
-
- private static final long serialVersionUID = -3665659846001987187L;
-
- /**
- * Type name;
- */
- private final String typeName;
-
- /**
- * Values.
- */
- private final List<ODataValue> values = new ArrayList<ODataValue>();
-
- /**
- * Constructor.
- *
- * @param typeName type name.
- */
- public ODataCollectionValue(final String typeName) {
- this.typeName = typeName;
- }
+public interface ODataCollectionValue extends ODataValue, Iterable<ODataValue> {
/**
* Adds a value to the collection.
*
* @param value value to be added.
*/
- public void add(final ODataValue value) {
- if (value.isPrimitive() || value.isComplex()) {
- values.add(value);
- }
- }
+ void add(ODataValue value);
/**
- * Value iterator.
- *
- * @return value iterator.
- */
- @Override
- public Iterator<ODataValue> iterator() {
- return values.iterator();
- }
-
- /**
- * Gets value type name.
+ * Checks if collection is empty.
*
- * @return value type name.
+ * @return 'TRUE' if empty; 'FALSE' otherwise.
*/
- public String getType() {
- return typeName;
- }
+ boolean isEmpty();
/**
* Gets collection size.
*
* @return collection size.
*/
- public int size() {
- return values.size();
- }
-
- /**
- * Checks if collection is empty.
- *
- * @return 'TRUE' if empty; 'FALSE' otherwise.
- */
- public boolean isEmpty() {
- return values.isEmpty();
- }
+ int size();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
index b973718..ea4d832 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
@@ -18,44 +18,17 @@
*/
package org.apache.olingo.commons.api.domain;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
/**
* OData complex property value.
*/
-public class ODataComplexValue extends AbstractODataValue implements Iterable<ODataProperty> {
-
- private static final long serialVersionUID = -1878555027714020431L;
-
- /**
- * Type name.
- */
- private final String typeName;
-
- /**
- * Complex type fields.
- */
- private final Map<String, ODataProperty> fields = new LinkedHashMap<String, ODataProperty>();
-
- /**
- * Constructor.
- *
- * @param type type name.
- */
- public ODataComplexValue(final String typeName) {
- this.typeName = typeName;
- }
+public interface ODataComplexValue extends ODataValue, Iterable<ODataProperty> {
/**
* Adds field to the complex type.
*
* @param field field to be added.
*/
- public void add(final ODataProperty field) {
- fields.put(field.getName(), field);
- }
+ void add(ODataProperty field);
/**
* Gets field.
@@ -63,35 +36,13 @@ public class ODataComplexValue extends AbstractODataValue implements Iterable<OD
* @param name name of the field to be retrieved.
* @return requested field.
*/
- public ODataProperty get(final String name) {
- return fields.get(name);
- }
-
- /**
- * Complex property fields iterator.
- *
- * @return fields iterator.
- */
- @Override
- public Iterator<ODataProperty> iterator() {
- return fields.values().iterator();
- }
-
- /**
- * Gest value type name.
- *
- * @return value type name.
- */
- public String getType() {
- return typeName;
- }
+ ODataProperty get(String name);
/**
* Gets number of fields.
*
* @return number of fields.
*/
- public int size() {
- return fields.size();
- }
+ int size();
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
index a5826d1..44214ac 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
@@ -19,122 +19,30 @@
package org.apache.olingo.commons.api.domain;
import java.net.URI;
-import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang3.StringUtils;
/**
* OData entity.
*/
-public class ODataEntity extends AbstractODataPayload implements ODataInvokeResult {
+public interface ODataEntity extends ODataInvokeResult {
- private static final long serialVersionUID = 8360640095932811034L;
+ String getName();
- /**
- * Entity reference.
- */
- private String reference;
-
- /**
- * ETag.
- */
- private String eTag;
-
- /**
- * Media entity flag.
- */
- private boolean mediaEntity = false;
-
- /**
- * In case of media entity, media content type.
- */
- private String mediaContentType;
-
- /**
- * In case of media entity, media content source.
- */
- private String mediaContentSource;
-
- /**
- * Edit link.
- */
- protected URI editLink;
-
- /**
- * Navigation links (might contain in-line entities or feeds).
- */
- protected final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
-
- /**
- * Association links.
- */
- protected final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
-
- /**
- * Media edit links.
- */
- protected final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
-
- /**
- * Operations (legacy, functions, actions).
- */
- protected final List<ODataOperation> operations = new ArrayList<ODataOperation>();
-
- /**
- * Entity properties.
- */
- protected final List<ODataProperty> properties = new ArrayList<ODataProperty>();
-
- /**
- * Constructor.
- *
- * @param name OData entity name.
- */
- public ODataEntity(final String name) {
- super(name);
- }
-
- /**
- * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
- * to the resource path.
- * <br />
- * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
- * <br />
- * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
- * collection of entity references pointing to the related entities. If no entities are related, the response is the
- * format-specific representation of an empty collection.
- * <br />
- * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
- * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
- * such entity exists, the service returns 404 Not Found.
- *
- * @return entity reference.
- */
- public String getReference() {
- return reference;
- }
-
- public void setReference(final String reference) {
- this.reference = reference;
- }
+ URI getLink();
/**
* Gets ETag.
*
* @return ETag.
*/
- public String getETag() {
- return eTag;
- }
+ String getETag();
/**
* Sets ETag.
*
* @param eTag ETag.
*/
- public void setETag(final String eTag) {
- this.eTag = eTag;
- }
+ void setETag(String eTag);
/**
* Searches for operation with given title.
@@ -142,25 +50,14 @@ public class ODataEntity extends AbstractODataPayload implements ODataInvokeResu
* @param title operation to look for
* @return operation if found with given title, <tt>null</tt> otherwise
*/
- public ODataOperation getOperation(final String title) {
- ODataOperation result = null;
- for (ODataOperation operation : operations) {
- if (title.equals(operation.getTitle())) {
- result = operation;
- }
- }
-
- return result;
- }
+ ODataOperation getOperation(String title);
/**
* Gets operations.
*
* @return operations.
*/
- public List<ODataOperation> getOperations() {
- return this.operations;
- }
+ List<ODataOperation> getOperations();
/**
* Searches for property with given name.
@@ -168,28 +65,14 @@ public class ODataEntity extends AbstractODataPayload implements ODataInvokeResu
* @param name property to look for
* @return property if found with given name, <tt>null</tt> otherwise
*/
- public ODataProperty getProperty(final String name) {
- ODataProperty result = null;
-
- if (StringUtils.isNotBlank(name)) {
- for (ODataProperty property : properties) {
- if (name.equals(property.getName())) {
- result = property;
- }
- }
- }
-
- return result;
- }
+ ODataProperty getProperty(String name);
/**
* Returns OData entity properties.
*
* @return OData entity properties.
*/
- public List<ODataProperty> getProperties() {
- return properties;
- }
+ List<ODataProperty> getProperties();
/**
* Puts the given link into one of available lists, based on its type.
@@ -197,28 +80,7 @@ public class ODataEntity extends AbstractODataPayload implements ODataInvokeResu
* @param link to be added
* @return <tt>true</tt> if the given link was added in one of available lists
*/
- public boolean addLink(final ODataLink link) {
- boolean result = false;
-
- switch (link.getType()) {
- case ASSOCIATION:
- result = associationLinks.contains(link) ? false : associationLinks.add(link);
- break;
-
- case ENTITY_NAVIGATION:
- case ENTITY_SET_NAVIGATION:
- result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
- break;
-
- case MEDIA_EDIT:
- result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
- break;
-
- default:
- }
-
- return result;
- }
+ boolean addLink(ODataLink link);
/**
* Removes the given link from any list (association, navigation, edit-media).
@@ -226,120 +88,110 @@ public class ODataEntity extends AbstractODataPayload implements ODataInvokeResu
* @param link to be removed
* @return <tt>true</tt> if the given link was contained in one of available lists
*/
- public boolean removeLink(final ODataLink link) {
- return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
- }
+ boolean removeLink(ODataLink link);
/**
- * Returns all entity navigation links (including inline entities / feeds).
+ * Returns all entity association links.
*
* @return OData entity links.
*/
- public List<ODataLink> getNavigationLinks() {
- return navigationLinks;
- }
+ List<ODataLink> getAssociationLinks();
/**
- * Returns all entity association links.
+ * Returns all entity navigation links (including inline entities / feeds).
*
* @return OData entity links.
*/
- public List<ODataLink> getAssociationLinks() {
- return associationLinks;
- }
+ List<ODataLink> getNavigationLinks();
/**
* Returns all entity media edit links.
*
* @return OData entity links.
*/
- public List<ODataLink> getEditMediaLinks() {
- return editMediaLinks;
- }
+ List<ODataLink> getEditMediaLinks();
/**
* Returns OData entity edit link.
*
* @return entity edit link.
*/
- public URI getEditLink() {
- return editLink;
- }
+ URI getEditLink();
/**
* Sets OData entity edit link.
*
* @param editLink edit link.
*/
- public void setEditLink(final URI editLink) {
- this.editLink = editLink;
- }
-
- @Override
- public URI getLink() {
- return super.getLink() == null ? getEditLink() : super.getLink();
- }
+ void setEditLink(URI editLink);
/**
* TRUE if read-only entity.
*
* @return TRUE if read-only; FALSE otherwise.
*/
- public boolean isReadOnly() {
- return super.getLink() != null;
- }
+ boolean isReadOnly();
/**
* Checks if the current entity is a media entity.
*
* @return 'TRUE' if media entity; 'FALSE' otherwise.
*/
- public boolean isMediaEntity() {
- return mediaEntity;
- }
+ boolean isMediaEntity();
/**
* Sets media entity flag.
*
* @param isMediaEntity media entity flag value.
*/
- public void setMediaEntity(final boolean isMediaEntity) {
- this.mediaEntity = isMediaEntity;
- }
+ void setMediaEntity(boolean isMediaEntity);
/**
* Gets media content type.
*
* @return media content type.
*/
- public String getMediaContentType() {
- return mediaContentType;
- }
+ String getMediaContentType();
/**
* Sets media content type.
*
* @param mediaContentType media content type.
*/
- public void setMediaContentType(final String mediaContentType) {
- this.mediaContentType = mediaContentType;
- }
+ void setMediaContentType(String mediaContentType);
/**
* Gets media content source.
*
* @return media content source.
*/
- public String getMediaContentSource() {
- return mediaContentSource;
- }
+ String getMediaContentSource();
/**
* Sets media content source.
*
* @param mediaContentSource media content source.
*/
- public void setMediaContentSource(final String mediaContentSource) {
- this.mediaContentSource = mediaContentSource;
- }
+ void setMediaContentSource(String mediaContentSource);
+
+ /**
+ * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
+ * to the resource path.
+ * <br />
+ * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
+ * <br />
+ * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
+ * collection of entity references pointing to the related entities. If no entities are related, the response is the
+ * format-specific representation of an empty collection.
+ * <br />
+ * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
+ * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
+ * such entity exists, the service returns 404 Not Found.
+ *
+ * @return entity reference.
+ */
+ String getReference();
+
+ void setReference(String reference);
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
index 083b7ad..99b6962 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
@@ -19,102 +19,39 @@
package org.apache.olingo.commons.api.domain;
import java.net.URI;
-import java.util.ArrayList;
import java.util.List;
/**
* OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available.
*/
-public class ODataEntitySet extends AbstractODataPayload implements ODataInvokeResult {
-
- private static final long serialVersionUID = 9039605899821494024L;
-
- /**
- * Link to the next page.
- */
- protected URI next;
-
- /**
- * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
- * there.
- */
- protected Integer count;
-
- /**
- * OData entities contained in this feed.
- */
- protected List<ODataEntity> entities = new ArrayList<ODataEntity>();
-
- /**
- * Constructor.
- */
- public ODataEntitySet() {
- super(null);
- }
-
- /**
- * Constructor.
- *
- * @param next next link.
- */
- public ODataEntitySet(final URI next) {
- super(null);
- this.next = next;
- }
+public interface ODataEntitySet extends ODataInvokeResult {
/**
* Gets next page link.
*
* @return next page link; null value if single page or last page reached.
*/
- public URI getNext() {
- return next;
- }
+ URI getNext();
/**
- * Sets in-line count.
+ * Gets contained entities.
*
- * @param count in-line count value.
+ * @return feed entries.
*/
- public void setCount(final int count) {
- this.count = count;
- }
+ List<ODataEntity> getEntities();
/**
* Gets in-line count.
*
* @return in-line count value.
*/
- public int getCount() {
- return count == null ? entities.size() : count;
- }
-
- /**
- * Adds entity to the current feed.
- *
- * @param entity entity to be added.
- * @return 'FALSE' if already exists; 'TRUE' otherwise.
- */
- public boolean addEntity(final ODataEntity entity) {
- return entities.contains(entity) ? false : entities.add(entity);
- }
+ int getCount();
/**
- * Removes an entity.
+ * Sets in-line count.
*
- * @param entity entity to be removed.
- * @return 'TRUE' in case of success; 'FALSE' otherwise.
+ * @param count in-line count value.
*/
- public boolean removeEntity(final ODataEntity entity) {
- return entities.remove(entity);
- }
+ void setCount(final int count);
- /**
- * Gets contained entities.
- *
- * @return feed entries.
- */
- public List<ODataEntity> getEntities() {
- return entities;
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
index d8cbbbc..7114c5b 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
@@ -22,11 +22,6 @@ import java.net.URI;
/**
* Entry point for generating OData domain objects.
- *
- * @see ODataEntitySet
- * @see ODataEntity
- * @see ODataProperty
- * @see ODataLink
*/
public interface ODataObjectFactory {
@@ -180,6 +175,12 @@ public interface ODataObjectFactory {
*/
ODataLink newMediaEditLink(String name, URI baseURI, String href);
+ ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
+
+ ODataComplexValue newComplexValue(String typeName);
+
+ ODataCollectionValue newCollectionValue(String typeName);
+
/**
* Instantiates a new primitive property.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
index e43f68c..4cfa303 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
@@ -19,141 +19,73 @@
package org.apache.olingo.commons.api.domain;
import java.io.Serializable;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
/**
* OData entity property.
*/
-public class ODataProperty implements Serializable, ODataInvokeResult {
-
- private static final long serialVersionUID = 926939448778950450L;
-
- /**
- * Property name.
- */
- private final String name;
-
- /**
- * Property value.
- */
- private ODataValue value;
-
- /**
- * Constructor.
- *
- * @param name property name.
- * @param value property value.
- */
- public ODataProperty(final String name, final ODataValue value) {
- this.name = name;
- this.value = value;
- }
+public interface ODataProperty extends ODataInvokeResult, Serializable {
/**
* Returns property name.
*
* @return property name.
*/
- public String getName() {
- return name;
- }
-
- /**
- * Returns property value.
- *
- * @return property value.
- */
- public ODataValue getValue() {
- return value;
- }
+ String getName();
/**
* Checks if has null value.
*
* @return 'TRUE' if has null value; 'FALSE' otherwise.
*/
- public boolean hasNullValue() {
- return this.value == null;
- }
+ boolean hasNullValue();
/**
* Checks if has primitive value.
*
* @return 'TRUE' if has primitive value; 'FALSE' otherwise.
*/
- public boolean hasPrimitiveValue() {
- return !hasNullValue() && this.value.isPrimitive();
- }
+ boolean hasPrimitiveValue();
/**
* Gets primitive value.
*
* @return primitive value if exists; null otherwise.
*/
- public ODataPrimitiveValue getPrimitiveValue() {
- return hasPrimitiveValue() ? this.value.asPrimitive() : null;
- }
+ ODataPrimitiveValue getPrimitiveValue();
/**
- * Checks if has complex value.
- *
- * @return 'TRUE' if has complex value; 'FALSE' otherwise.
- */
- public boolean hasComplexValue() {
- return !hasNullValue() && this.value.isComplex();
- }
-
- /**
- * Gets complex value.
+ * Returns property value.
*
- * @return complex value if exists; null otherwise.
+ * @return property value.
*/
- public ODataComplexValue getComplexValue() {
- return hasComplexValue() ? this.value.asComplex() : null;
- }
+ ODataValue getValue();
/**
* Checks if has collection value.
*
* @return 'TRUE' if has collection value; 'FALSE' otherwise.
*/
- public boolean hasCollectionValue() {
- return !hasNullValue() && this.value.isCollection();
- }
+ boolean hasCollectionValue();
/**
* Gets collection value.
*
* @return collection value if exists; null otherwise.
*/
- public ODataCollectionValue getCollectionValue() {
- return hasCollectionValue() ? this.value.asCollection() : null;
- }
+ ODataCollectionValue getCollectionValue();
/**
- * {@inheritDoc }
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
*/
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
+ boolean hasComplexValue();
/**
- * {@inheritDoc }
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
*/
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
+ ODataComplexValue getComplexValue();
- /**
- * {@inheritDoc }
- */
- @Override
- public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
index b427e8f..6db4b2b 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
@@ -26,6 +26,13 @@ import java.io.Serializable;
public interface ODataValue extends Serializable {
/**
+ * Gets value type name.
+ *
+ * @return value type name.
+ */
+ String getTypeName();
+
+ /**
* Check is is a primitive value.
*
* @return 'TRUE' if primitive; 'FALSE' otherwise.
[06/51] [abbrv] [OLINGO-200] Introducing specialization for V3 and V4
domain objects
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 0a1d503..446b41d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -18,9 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
@@ -28,13 +25,16 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@@ -90,7 +90,8 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
@@ -143,7 +144,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final ODataRawResponse res = req.execute();
assertNotNull(res);
- final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+ final CommonODataEntitySet entitySet = res.getBodyAs(CommonODataEntitySet.class);
assertNotNull(entitySet);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index fed9ba4..6ed898d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -18,23 +18,24 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
import java.net.URI;
import java.util.LinkedHashMap;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
-import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
import org.junit.Test;
/**
@@ -52,7 +53,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
merge.setEditLink(uri);
updateEntityDescription(format, merge, UpdateType.MERGE, etag);
}
@@ -63,7 +64,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
merge.setEditLink(uri);
updateEntityDescription(format, merge, UpdateType.MERGE, etag);
}
@@ -74,7 +75,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
patch.setEditLink(uri);
updateEntityDescription(format, patch, UpdateType.PATCH, etag);
}
@@ -85,7 +86,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
patch.setEditLink(uri);
updateEntityDescription(format, patch, UpdateType.PATCH, etag);
}
@@ -93,7 +94,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void replaceAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
+ final CommonODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -101,7 +102,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void replaceAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
+ final CommonODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -120,7 +121,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).build();
- final ODataEntity patch =
+ final CommonODataEntity patch =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
patch.setEditLink(uri);
@@ -137,10 +138,10 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
customerInfoURI = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Info").build();
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(customerInfoURI);
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(customerInfoURI);
req.setFormat(format);
- ODataEntity newInfo = req.execute().getBody();
+ CommonODataEntity newInfo = req.execute().getBody();
assertEquals(Integer.valueOf(12),
newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
@@ -178,16 +179,17 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
multiKey.put("FromUsername", "1");
multiKey.put("MessageId", -10);
- final ODataEntity message = read(format, client.getURIBuilder(getServiceRoot()).
+ final CommonODataEntity message = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Message").appendKeySegment(multiKey).build());
message.getAssociationLinks().clear();
message.getNavigationLinks().clear();
final boolean before = message.getProperty("IsRead").getPrimitiveValue().toCastValue(Boolean.class);
message.getProperties().remove(message.getProperty("IsRead"));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(!before).
- setType(EdmPrimitiveTypeKind.Boolean).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("IsRead",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(!before).
+ setType(EdmPrimitiveTypeKind.Boolean).build()));
return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
}
@@ -224,7 +226,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
String etag = getETag(uri);
- final ODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
product.setEditLink(uri);
updateEntityStringProperty("BaseConcurrency",
client.getConfiguration().getDefaultPubFormat(), product, UpdateType.MERGE, etag);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index ed8a776..04c41de 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -18,11 +18,11 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URI;
@@ -32,16 +32,17 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.junit.Test;
/**
@@ -79,7 +80,7 @@ public class ErrorTestITCase extends AbstractTestITCase {
}
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
return odataClient.getObjectFactory().newEntity("Invalid");
}
}
@@ -117,7 +118,7 @@ public class ErrorTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer(154)");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
try {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
index 28c354d..de6808c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.URIFilter;
import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
@@ -42,7 +42,7 @@ public class FilterFactoryTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entitySet).filter(filter);
- final ODataEntitySet feed = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
+ final CommonODataEntitySet feed = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
execute().getBody();
assertNotNull(feed);
assertEquals(expected, feed.getEntities().size());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
index cbcf046..44be0fe 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.it.v3;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
@@ -30,7 +30,7 @@ public class FilterTestITCase extends AbstractTestITCase {
private void filterQueryTest(final String entity, final String filter, final int expected) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entity).filter(filter);
- final ODataEntitySet entitySet = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
+ final CommonODataEntitySet entitySet = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
execute().getBody();
assertNotNull(entitySet);
assertEquals(expected, entitySet.getEntities().size());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
index dac96e6..4a9d05f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
@@ -21,13 +21,14 @@ package org.apache.olingo.client.core.it.v3;
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.junit.AfterClass;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -42,7 +43,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -67,10 +68,10 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
public void createODataEntityAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 1;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(testStaticServiceRootURL, format, original, "Customer");
- final ODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
+ final CommonODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
cleanAfterCreate(format, actual, false, testStaticServiceRootURL);
}
@@ -79,10 +80,10 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
public void createODataEntityAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 2;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(testStaticServiceRootURL, format, original, "Customer");
- final ODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
+ final CommonODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
cleanAfterCreate(format, actual, false, testStaticServiceRootURL);
}
@@ -90,7 +91,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void replaceODataEntityAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
+ final CommonODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -98,7 +99,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void replaceODataEntityAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
+ final CommonODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
index 3350204..03bdf00 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
@@ -36,8 +36,8 @@ import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreat
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.communication.response.ODataStreamUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
@@ -164,12 +164,12 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
final ODataMediaEntityCreateResponse createRes = streamManager.getResponse();
assertEquals(201, createRes.getStatusCode());
- final ODataEntity created = createRes.getBody();
+ final CommonODataEntity created = createRes.getBody();
assertNotNull(created);
assertEquals(2, created.getProperties().size());
Integer id = null;
- for (ODataProperty prop : created.getProperties()) {
+ for (CommonODataProperty prop : created.getProperties()) {
if ("VIN".equals(prop.getName())) {
id = prop.getPrimitiveValue().toCastValue(Integer.class);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index 5cc8770..fcbbe80 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-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.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -38,25 +33,30 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-import org.junit.Test;
-
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+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 org.junit.Ignore;
+import org.junit.Test;
public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
@@ -66,7 +66,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 20, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 20, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create navigation link with JSON full metadata
@@ -76,7 +76,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 21, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 21, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// throws Null pointer exception when the format is JSON No metadata
@@ -86,7 +86,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
final String contentType = "application/json;odata=nometadata";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 22, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 22, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON accept and atom content type
@@ -97,7 +97,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 23, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 23, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON full metadata in format and json no metadata in content type
@@ -107,7 +107,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=nometadata";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 24, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 24, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON no metadata format and json no metadata in content type
@@ -117,7 +117,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 25, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 25, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create collection navigation link with ATOM
@@ -127,7 +127,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final ODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
+ final CommonODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create collection navigation link with JSON
@@ -137,27 +137,27 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final ODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
+ final CommonODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create a navigation link
- public ODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
+ public CommonODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
final String prefer) {
final String name = "Customer Navigation test";
- final ODataEntity original = getNewCustomer(id, name, false);
+ final CommonODataEntity original = getNewCustomer(id, name, false);
original.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info", URI.create(testStaticServiceRootURL + "/CustomerInfo(11)")));
- final ODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
+ final CommonODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
prefer);
- final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
+ final CommonODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
req.setContentType(contenttype);
req.setPrefer(prefer);
@@ -175,7 +175,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// create a navigation link
- public ODataEntity createNav(final String url, final ODataPubFormat format, final ODataEntity original,
+ public CommonODataEntity createNav(final String url, final ODataPubFormat format, final CommonODataEntity original,
final String entitySetName, final String contentType, final String prefer) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(url);
uriBuilder.appendEntitySetSegment(entitySetName);
@@ -189,32 +189,34 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
assertEquals("Created", createRes.getStatusMessage());
- final ODataEntity created = createRes.getBody();
+ final CommonODataEntity created = createRes.getBody();
assertNotNull(created);
return created;
}
// create collection navigation link
- public ODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
+ public CommonODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
final String contentType, final String prefer) throws EdmPrimitiveTypeException {
{
final String name = "Collection Navigation Key Customer";
- final ODataEntity original = getNewCustomer(id, name, false);
+ final CommonODataEntity original = getNewCustomer(id, name, false);
final Set<Integer> navigationKeys = new HashSet<Integer>();
navigationKeys.add(-118);
navigationKeys.add(-119);
for (Integer key : navigationKeys) {
- final ODataEntity orderEntity =
+ final CommonODataEntity orderEntity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
- orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
- setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(orderEntity,
+ client.getObjectFactory().newPrimitiveProperty("OrderId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(orderEntity,
+ client.getObjectFactory().newPrimitiveProperty("CustomerId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
@@ -225,26 +227,27 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
"Orders",
createReq.execute().getBody().getEditLink()));
}
- final ODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
+ final CommonODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
contentType, prefer);
- final ODataEntity actualEntity =
+ final CommonODataEntity actualEntity =
validateEntities(testStaticServiceRootURL, format, createdEntity, id, null, "Customer");
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntitySet entitySet = res.getBody();
+ final CommonODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
assertEquals(2, entitySet.getCount());
- for (ODataEntity entity : entitySet.getEntities()) {
+ for (CommonODataEntity entity : entitySet.getEntities()) {
final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(navigationKeys.contains(key));
@@ -262,22 +265,24 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// get a Customer entity to be created
- public ODataEntity getNewCustomer(
+ public CommonODataEntity getNewCustomer(
final int id, final String name, final boolean withInlineInfo) {
- final ODataEntity entity =
+ final CommonODataEntity entity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
// add name attribute
- entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(name).
- setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(entity,
+ client.getObjectFactory().newPrimitiveProperty("Name",
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(name).
+ setType(EdmPrimitiveTypeKind.String).build()));
// add key attribute
if (id != 0) {
- entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
- setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(entity,
+ client.getObjectFactory().newPrimitiveProperty("CustomerId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
}
final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
@@ -319,8 +324,8 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
backupContactInfoValue.add(contactDetails);
- entity.getProperties().add(client.getObjectFactory().newCollectionProperty("BackupContactInfo",
- backupContactInfoValue));
+ getClient().getBinder().add(entity,
+ client.getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
if (withInlineInfo) {
final ODataInlineEntity inlineInfo = client.getObjectFactory().newInlineEntity("Info", URI.create(
"Customer(" + id
@@ -333,7 +338,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
//delete an entity and associated links after creation
- public void delete(final ODataPubFormat format, final ODataEntity created, final boolean includeInline,
+ public void delete(final ODataPubFormat format, final CommonODataEntity created, final boolean includeInline,
final String baseUri) {
final Set<URI> toBeDeleted = new HashSet<URI>();
toBeDeleted.add(created.getEditLink());
@@ -341,15 +346,15 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
if (includeInline) {
for (ODataLink link : created.getNavigationLinks()) {
if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
if (inline.getEditLink() != null) {
toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
}
}
if (link instanceof ODataInlineEntitySet) {
- final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
- for (ODataEntity entity : inline.getEntities()) {
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ for (CommonODataEntity entity : inline.getEntities()) {
if (entity.getEditLink() != null) {
toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
}
@@ -371,21 +376,21 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// add Information property
- public ODataEntity getInfo(final int id, final String info) {
- final ODataEntity entity =
+ public CommonODataEntity getInfo(final int id, final String info) {
+ final CommonODataEntity entity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
entity.setMediaEntity(true);
- entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
+ getClient().getBinder().add(entity, client.getObjectFactory().newPrimitiveProperty("Information",
client.getObjectFactory().newPrimitiveValueBuilder().setText(info).
setType(EdmPrimitiveTypeKind.String).build()));
return entity;
}
// validate newly created entities
- public ODataEntity validateEntities(final String serviceRootURL,
+ public CommonODataEntity validateEntities(final String serviceRootURL,
final ODataPubFormat format,
- final ODataEntity original,
+ final CommonODataEntity original,
final int actualObjectId,
final Collection<String> expands, final String entitySetName) {
@@ -397,7 +402,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
uriBuilder.expand(expand);
}
}
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -438,10 +443,10 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
assertNotNull(foundActual);
if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
- final ODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
+ final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
assertNotNull(originalInline);
- final ODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
+ final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
assertNotNull(actualInline);
checkProperties(originalInline.getProperties(), actualInline.getProperties());
@@ -451,22 +456,24 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// compares properties of the newly created entity with the properties that were originally provided
@Override
- public void checkProperties(final Collection<ODataProperty> original, final Collection<ODataProperty> actual) {
+ public void checkProperties(final Collection<? extends CommonODataProperty> original,
+ final Collection<? extends CommonODataProperty> actual) {
+
assertTrue(original.size() <= actual.size());
- final Map<String, ODataProperty> actualProperties = new HashMap<String, ODataProperty>(actual.size());
+ final Map<String, CommonODataProperty> actualProperties = new HashMap<String, CommonODataProperty>(actual.size());
- for (ODataProperty prop : actual) {
+ for (CommonODataProperty prop : actual) {
assertFalse(actualProperties.containsKey(prop.getName()));
actualProperties.put(prop.getName(), prop);
}
assertTrue(actual.size() <= actualProperties.size());
- for (ODataProperty prop : original) {
+ for (CommonODataProperty prop : original) {
assertNotNull(prop);
if (actualProperties.containsKey(prop.getName())) {
- final ODataProperty actualProp = actualProperties.get(prop.getName());
+ final CommonODataProperty actualProp = actualProperties.get(prop.getName());
assertNotNull(actualProp);
if (prop.getValue() != null && actualProp.getValue() != null) {
@@ -488,13 +495,13 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
original.getClass().getSimpleName(), actual.getClass().getSimpleName());
if (original.isComplex()) {
- final List<ODataProperty> originalPropertyValue = new ArrayList<ODataProperty>();
- for (ODataProperty prop : original.asComplex()) {
+ final List<CommonODataProperty> originalPropertyValue = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : original.asComplex()) {
originalPropertyValue.add(prop);
}
- final List<ODataProperty> actualPropertyValue = new ArrayList<ODataProperty>();
- for (ODataProperty prop : (ODataComplexValue) actual) {
+ final List<CommonODataProperty> actualPropertyValue = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : (ODataComplexValue) actual) {
actualPropertyValue.add(prop);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index d00bf8b..f576a03 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -29,7 +29,7 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateR
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.edm.Edm;
@@ -61,14 +61,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
// assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType());
}
- private ODataEntity readRow(final ODataPubFormat format, final String uuid) {
+ private CommonODataEntity readRow(final ODataPubFormat format, final String uuid) {
final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid));
return read(format, builder.build());
}
private void read(final ODataPubFormat format) {
- ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
+ CommonODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
assertEquals(EdmPrimitiveTypeKind.Double, row.getProperty("Double").getPrimitiveValue().getTypeKind());
assertEquals(EdmPrimitiveTypeKind.Guid, row.getProperty("Id").getPrimitiveValue().getTypeKind());
@@ -91,60 +91,74 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
private void cud(final ODataPubFormat format) {
final UUID guid = UUID.randomUUID();
- ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Id",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aString",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.String).setValue("string").
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aBoolean",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLong",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDouble",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aByte",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDate",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
- build()));
+ CommonODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("Id",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aString",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.String).setValue("string").
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aBoolean",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aLong",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aDouble",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aByte",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aDate",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
+ build()));
final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
point.setX(1.2);
point.setY(2.1);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPoint",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
- setValue(point).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aPoint",
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
+ setValue(point).build()));
final List<Point> points = new ArrayList<Point>();
points.add(point);
points.add(point);
final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
- setValue(multipoint).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
+ setValue(multipoint).build()));
final LineString lineString = new LineString(Geospatial.Dimension.GEOMETRY, null, points);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLineString",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
- setValue(lineString).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aLineString",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryLineString).
+ setValue(lineString).build()));
final List<LineString> lineStrings = new ArrayList<LineString>();
lineStrings.add(lineString);
lineStrings.add(lineString);
final MultiLineString multiLineString = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, null, lineStrings);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
- setValue(multiLineString).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
+ setValue(multiLineString).build()));
final Point otherPoint = new Point(Geospatial.Dimension.GEOGRAPHY, null);
otherPoint.setX(3.4);
otherPoint.setY(4.3);
@@ -152,25 +166,31 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
points.add(otherPoint);
points.add(point);
final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, points, points);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPolygon",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
- setValue(polygon).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aPolygon",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyPolygon).
+ setValue(polygon).build()));
final List<Polygon> polygons = new ArrayList<Polygon>();
polygons.add(polygon);
polygons.add(polygon);
final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, null, polygons);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
- setValue(multiPolygon).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
+ setValue(multiPolygon).build()));
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
geospatials.add(otherPoint);
geospatials.add(polygon);
geospatials.add(multiLineString);
geospatials.add(multiPolygon);
final GeospatialCollection geoColl = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, geospatials);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aCollection",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
- setValue(geoColl).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aCollection",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyCollection).
+ setValue(geoColl).build()));
final ODataComplexValue contactDetails = client.getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
@@ -210,7 +230,8 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Long",
client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Int64).setValue(Long.MAX_VALUE).build()));
- row.getProperties().add(client.getObjectFactory().newComplexProperty("aContact", contactDetails));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newComplexProperty("aContact", contactDetails));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
getEntityCreateRequest(client.getURIBuilder(testStaticServiceRootURL).
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
index c6763e9..56db6fb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
@@ -25,21 +25,23 @@ import java.math.BigDecimal;
import java.util.UUID;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
+
import org.junit.Test;
public class PrimitiveKeysTestITCase extends AbstractTestITCase {
private void readEntity(final String entityType, final Object key, final ODataPubFormat format) {
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment(entityType).
appendKeySegment(key).
build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntity entity = res.getBody();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
assertNotNull(entity.getProperty("Id"));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
index 314e934..2e495dc 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
@@ -18,25 +18,26 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
import java.util.List;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import org.junit.Test;
public class PropertyRetrieveTestITCase extends AbstractTestITCase {
@@ -44,7 +45,8 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
private void retreivePropertyTest(final ODataFormat format, String entitySegment, String structuralSegment) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entitySegment).appendPropertySegment(structuralSegment);
- final ODataPropertyRequest req = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
req.setFormat(format);
try {
final ODataProperty property = req.execute().getBody();
@@ -210,13 +212,14 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
public void navigationMediaLink() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photos");
- ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setAccept("application/json");
ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- ODataEntitySet entitySet = res.getBody();
+ CommonODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
- List<ODataEntity> entity = entitySet.getEntities();
+ List<? extends CommonODataEntity> entity = entitySet.getEntities();
assertNotNull(entity);
assertEquals(entity.size(), 2);
assertEquals(testStaticServiceRootURL + "/ProductPhoto(PhotoId=-3,ProductId=-3)",
@@ -233,14 +236,15 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
public void navigationMediaLinkInvalidQuery() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photo");
- ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setAccept("application/json");
try {
ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- ODataEntitySet entitySet = res.getBody();
+ CommonODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
- List<ODataEntity> entity = entitySet.getEntities();
+ List<? extends CommonODataEntity> entity = entitySet.getEntities();
assertNotNull(entity);
assertEquals(entity.size(), 2);
assertEquals(testStaticServiceRootURL + "/ProductPhoto(PhotoId=-3,ProductId=-3)", entity.get(0).
@@ -256,7 +260,8 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
public void navigationMediaLinkInvalidFormat() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photos");
- ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setAccept("application/atom+xml");
try {
ODataRetrieveResponse<ODataEntitySet> res = req.execute();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index ddcd75f..9d10d24 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -18,10 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
@@ -35,15 +31,19 @@ import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateRe
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@@ -206,7 +206,8 @@ public class PropertyTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-9).appendPropertySegment("PrimaryContactInfo");
- ODataPropertyRequest retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
retrieveReq.setFormat(format);
ODataRetrieveResponse<ODataProperty> retrieveRes = retrieveReq.execute();
@@ -253,7 +254,8 @@ public class PropertyTestITCase extends AbstractTestITCase {
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-9).
appendPropertySegment("PrimaryContactInfo").appendPropertySegment("AlternativeNames");
- ODataPropertyRequest retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
retrieveReq.setFormat(format);
ODataRetrieveResponse<ODataProperty> retrieveRes = retrieveReq.execute();
@@ -301,13 +303,14 @@ public class PropertyTestITCase extends AbstractTestITCase {
appendPropertySegment("PrimaryContactInfo").
appendPropertySegment("HomePhone").appendPropertySegment("PhoneNumber");
- ODataPropertyRequest retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
retrieveReq.setFormat(format);
ODataRetrieveResponse<ODataProperty> retrieveRes = retrieveReq.execute();
assertEquals(200, retrieveRes.getStatusCode());
- ODataProperty phoneNumber = retrieveRes.getBody();
+ CommonODataProperty phoneNumber = retrieveRes.getBody();
final String oldMsg = phoneNumber.getPrimitiveValue().toCastValue(String.class);
final String newMsg = "new item " + System.currentTimeMillis();
@@ -349,7 +352,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final ODataRawResponse res = req.execute();
assertNotNull(res);
- final ODataProperty property = res.getBodyAs(ODataProperty.class);
+ final CommonODataProperty property = res.getBodyAs(CommonODataProperty.class);
assertNotNull(property);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
index 3660cad..02a964d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
@@ -18,16 +18,16 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.*;
import java.io.IOException;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import static org.junit.Assert.*;
import org.junit.Test;
public class PropertyValueTestITCase extends AbstractTestITCase {
@@ -72,7 +72,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveDatePropertyValueTest() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-7).appendPropertySegment(
- "NestedComplexConcurrency/ModifiedDate").appendValueSegment();
+ "NestedComplexConcurrency/ModifiedDate").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);
final ODataValue value = req.execute().getBody();
@@ -96,7 +96,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveBinaryPropertyValueTest() throws IOException {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/json");
ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
@@ -111,7 +111,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveBinaryPropertyValueTestWithAtom() throws IOException {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/atom+xml");
ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
@@ -126,7 +126,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveBinaryPropertyValueTestWithXML() throws IOException {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/xml");
ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
@@ -141,7 +141,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveCollectionPropertyValueTest() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-7).appendPropertySegment(
- "ComplexConcurrency/QueriedDateTime").appendValueSegment();
+ "ComplexConcurrency/QueriedDateTime").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);
final ODataValue value = req.execute().getBody();
@@ -155,7 +155,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveNullPropertyValueTest() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-10).appendPropertySegment(
- "ComplexConcurrency/Token").appendValueSegment();
+ "ComplexConcurrency/Token").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
try {
req.execute().getBody();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index 9f9c2c3..a45da3a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -18,25 +18,26 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
/**
@@ -64,14 +65,15 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
appendEntitySetSegment("Car").filter("(VIN lt 16)");
// 1. check that filtered entity set looks as expected
- ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
ODataEntitySet feed = req.execute().getBody();
assertNotNull(feed);
assertEquals(5, feed.getEntities().size());
// 2. extract VIN values - sorted ASC by default
final List<Integer> vinsASC = new ArrayList<Integer>(5);
- for (ODataEntity entity : feed.getEntities()) {
+ for (CommonODataEntity entity : feed.getEntities()) {
final Integer vin = entity.getProperty("VIN").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(vin < 16);
vinsASC.add(vin);
@@ -85,7 +87,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
// 4. extract again VIN value - now they were required to be sorted DESC
final List<Integer> vinsDESC = new ArrayList<Integer>(5);
- for (ODataEntity entity : feed.getEntities()) {
+ for (CommonODataEntity entity : feed.getEntities()) {
vinsDESC.add(entity.getProperty("VIN").getPrimitiveValue().toCastValue(Integer.class));
}
@@ -102,7 +104,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10).format("json");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.ATOM);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -137,7 +139,8 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").skipToken("-10");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
final ODataEntitySet feed = req.execute().getBody();
assertNotNull(feed);
assertEquals(2, feed.getEntities().size());
@@ -155,7 +158,8 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car").
inlineCount(InlineCount.allpages);
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.ATOM);
final ODataEntitySet feed = req.execute().getBody();
assertNotNull(feed);
@@ -170,7 +174,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10).select("CustomerId,Orders").expand("Orders");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
final ODataEntity customer = req.execute().getBody();
assertEquals(1, customer.getProperties().size());
assertEquals(1, customer.getNavigationLinks().size());
@@ -182,7 +186,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-7).select("Name");
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.ATOM);
final ODataEntity customer = req.execute().getBody();
[33/51] [abbrv] [OLINGO-168] More TechProvider Refactoring
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java
index 6a0708f..81f638d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java
@@ -40,7 +40,7 @@ public class SchemaProvider {
public static final String nameSpace = "com.sap.odata.test1";
- public SchemaProvider(EdmTechProvider prov) {
+ public SchemaProvider(final EdmTechProvider prov) {
this.prov = prov;
}
@@ -105,17 +105,17 @@ public class SchemaProvider {
// Actions
List<Action> actions = new ArrayList<Action>();
schema.setActions(actions);
- actions.addAll(prov.getActions(ActionProvider.nameUARTPrimParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTPrimCollParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTCompParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTCompCollParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTETParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTETCollAllPrimParam));
actions.addAll(prov.getActions(ActionProvider.nameBAETTwoKeyNavRTETTwoKeyNav));
actions.addAll(prov.getActions(ActionProvider.nameBAESAllPrimRTETAllPrim));
actions.addAll(prov.getActions(ActionProvider.nameBAESTwoKeyNavRTESTwoKeyNav));
actions.addAll(prov.getActions(ActionProvider.nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav));
actions.addAll(prov.getActions(ActionProvider.nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav));
+ actions.addAll(prov.getActions(ActionProvider.nameUARTPrimParam));
+ actions.addAll(prov.getActions(ActionProvider.nameUARTPrimCollParam));
+ actions.addAll(prov.getActions(ActionProvider.nameUARTCompParam));
+ actions.addAll(prov.getActions(ActionProvider.nameUARTCompCollParam));
+ actions.addAll(prov.getActions(ActionProvider.nameUARTETParam));
+ actions.addAll(prov.getActions(ActionProvider.nameUARTESParam));
// Functions
List<Function> functions = new ArrayList<Function>();
@@ -127,7 +127,6 @@ public class SchemaProvider {
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNavParamCTTwoPrim));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTStringTwoParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTESTwoKeyNavParam));
- // TODO: check why it exists twice
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTString));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollStringTwoParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollString));
@@ -140,6 +139,7 @@ public class SchemaProvider {
functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTESMixPrimCollCompTwoParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETAllPrimTwoParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTESMixPrimCollCompTwoParam));
+ functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTCollCTNavFiveProp));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTESTwoKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCStringRTESTwoKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETBaseTwoKeyNavRTETTwoKeyNav));
@@ -163,11 +163,14 @@ public class SchemaProvider {
functions.addAll(prov.getFunctions(FunctionProvider.nameBFESTwoKeyNavRTESTwoKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTETTwoKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTCTTwoPrim));
+
+ functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCTNavFiveProp));
+ functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCollCTNavFiveProp));
+
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTStringParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTETKeyNavParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTETTwoKeyNavParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBAETTwoKeyNavRTETTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNavParam));
+ //functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNavParam));
// EntityContainer
EntityContainer container = new EntityContainer();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java
index 879affd..dc34b31 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java
@@ -23,7 +23,7 @@ import org.apache.olingo.server.api.edm.provider.TypeDefinition;
public class TypeDefinitionProvider {
- public TypeDefinition getTypeDefinition(FullQualifiedName typeDefinitionName) {
+ public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) {
return null;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
index ab0b1d3..50b7a5d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
@@ -593,7 +593,7 @@ public class TestUriParserImpl {
testRes.run("FINRTInt16()")
.isFunctionImport("FINRTInt16")
.isFunction("UFNRTInt16")
- .isType(PropertyProvider.nameString);
+ .isType(PropertyProvider.nameInt16);
// one input
testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
@@ -614,7 +614,7 @@ public class TestUriParserImpl {
testRes.run("FINRTInt16()")
.isFunctionImport("FINRTInt16")
.isFunction("UFNRTInt16")
- .isType(PropertyProvider.nameString, false);
+ .isType(PropertyProvider.nameInt16, false);
// returning collection of primitive
testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
[09/51] [abbrv] git commit: Merge branch 'olingo200' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Posted by sk...@apache.org.
Merge branch 'olingo200' of https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/abe0e15e
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/abe0e15e
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/abe0e15e
Branch: refs/heads/olingo-206-validator
Commit: abe0e15e9365c2ba633c8418b0a7cb91c14c215d
Parents: 80e5ed5 4931b30
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 16:55:47 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 16:55:47 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/uri/CommonURIBuilder.java | 13 ++++--
.../client/core/uri/AbstractURIBuilder.java | 24 +++++++++-
.../olingo/client/core/uri/ParameterAlias.java | 48 ++++++++++++++++++++
.../apache/olingo/client/core/uri/URIUtils.java | 40 ++++++++--------
.../client/core/uri/v3/URIBuilderTest.java | 13 ++++++
5 files changed, 115 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
[11/51] [abbrv] git commit: [OLINGO-200] V3/V4 specialization for
ODataEntitySetIterator
Posted by sk...@apache.org.
[OLINGO-200] V3/V4 specialization for ODataEntitySetIterator
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/cd7ede00
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/cd7ede00
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/cd7ede00
Branch: refs/heads/olingo-206-validator
Commit: cd7ede00e279252d5d85990b1e29ff90c8df6b1f
Parents: a884ad1
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 20:17:26 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 20:17:26 2014 +0100
----------------------------------------------------------------------
.../retrieve/CommonRetrieveRequestFactory.java | 5 ++++-
.../retrieve/ODataEntitySetIteratorRequest.java | 5 ++++-
.../request/retrieve/v3/RetrieveRequestFactory.java | 5 +++++
.../request/retrieve/v4/RetrieveRequestFactory.java | 5 +++++
.../client/api/domain/ODataEntitySetIterator.java | 13 ++++++++-----
.../retrieve/AbstractRetrieveRequestFactory.java | 6 ------
.../retrieve/ODataEntitySetIteratorRequestImpl.java | 16 +++++++++-------
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 8 ++++++++
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 8 ++++++++
.../client/core/it/v3/EntitySetTestITCase.java | 14 ++++++++------
.../client/core/it/v4/EntitySetTestITCase.java | 13 +++++++------
11 files changed, 66 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
index 02ca4ee..f8d48b3 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
@@ -74,10 +74,13 @@ public interface CommonRetrieveRequestFactory extends Serializable {
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
* the entire entity set.
*
+ * @param <ES> concreate ODataEntitySet implementation.
+ * @param <E> concrete ODataEntity implementation.
* @param uri request URI.
* @return new {@link ODataEntitySetIteratorRequest} instance.
*/
- ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI uri);
+ <ES extends CommonODataEntitySet, E extends CommonODataEntity>
+ ODataEntitySetIteratorRequest<ES, E> getEntitySetIteratorRequest(URI uri);
/**
* Gets a query request returning a single OData entity.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
index dd2cf46..724b644 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
@@ -19,10 +19,13 @@
package org.apache.olingo.client.api.communication.request.retrieve;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
*/
-public interface ODataEntitySetIteratorRequest extends ODataRetrieveRequest<ODataEntitySetIterator, ODataPubFormat> {
+public interface ODataEntitySetIteratorRequest<ES extends CommonODataEntitySet, E extends CommonODataEntity>
+ extends ODataRetrieveRequest<ODataEntitySetIterator<ES, E>, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
index 25276fe..00568bd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
@@ -21,6 +21,7 @@ package org.apache.olingo.client.api.communication.request.retrieve.v3;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
@@ -35,6 +36,10 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
@SuppressWarnings("unchecked")
@Override
+ ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
+
+ @SuppressWarnings("unchecked")
+ @Override
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
index 8d8184b..63f3515 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
@@ -21,6 +21,7 @@ package org.apache.olingo.client.api.communication.request.retrieve.v4;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
@@ -33,6 +34,10 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
@Override
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
+ @SuppressWarnings("unchecked")
+ @Override
+ ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
+
@Override
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index 66e3476..dd77a44 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -42,7 +42,8 @@ import org.slf4j.LoggerFactory;
* <br/>
* <b>Please don't forget to call the <tt>close()>/<tt> method when not needed any more.</b>
*/
-public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
+public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends CommonODataEntity>
+ implements Iterator<E> {
/**
* Logger.
@@ -59,7 +60,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
private Entry cached;
- private CommonODataEntitySet entitySet;
+ private ES entitySet;
private final ByteArrayOutputStream osFeed;
@@ -104,6 +105,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
* {@inheritDoc }
*/
@Override
+ @SuppressWarnings("unchecked")
public boolean hasNext() {
if (available && cached == null) {
if (format == ODataPubFormat.ATOM) {
@@ -114,7 +116,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
if (cached == null) {
available = false;
- entitySet = odataClient.getReader().
+ entitySet = (ES) odataClient.getReader().
readEntitySet(new ByteArrayInputStream(osFeed.toByteArray()), format);
close();
}
@@ -127,9 +129,10 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
* {@inheritDoc }
*/
@Override
- public CommonODataEntity next() {
+ public E next() {
if (hasNext()) {
- final CommonODataEntity res = odataClient.getBinder().getODataEntity(cached);
+ @SuppressWarnings("unchecked")
+ final E res = (E) odataClient.getBinder().getODataEntity(cached);
cached = null;
return res;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
index d8ec0f2..a801953 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
@@ -21,7 +21,6 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
@@ -40,11 +39,6 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe
}
@Override
- public ODataEntitySetIteratorRequest getEntitySetIteratorRequest(final URI query) {
- return new ODataEntitySetIteratorRequestImpl(client, query);
- }
-
- @Override
public ODataValueRequest getValueRequest(final URI query) {
return new ODataValueRequestImpl(client, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
index bfdddef..a1e9a8b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
@@ -25,14 +25,16 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
*/
-public class ODataEntitySetIteratorRequestImpl
- extends AbstractODataRetrieveRequest<ODataEntitySetIterator, ODataPubFormat>
- implements ODataEntitySetIteratorRequest {
+public class ODataEntitySetIteratorRequestImpl<ES extends CommonODataEntitySet, E extends CommonODataEntity>
+ extends AbstractODataRetrieveRequest<ODataEntitySetIterator<ES, E>, ODataPubFormat>
+ implements ODataEntitySetIteratorRequest<ES, E> {
private ODataEntitySetIterator feedIterator = null;
@@ -42,7 +44,7 @@ public class ODataEntitySetIteratorRequestImpl
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntitySetIteratorRequestImpl(final CommonODataClient odataClient, final URI query) {
+ public ODataEntitySetIteratorRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
@@ -50,7 +52,7 @@ public class ODataEntitySetIteratorRequestImpl
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataEntitySetIterator> execute() {
+ public ODataRetrieveResponse<ODataEntitySetIterator<ES, E>> execute() {
final HttpResponse res = doExecute();
return new ODataEntitySetIteratorResponseImpl(httpClient, res);
}
@@ -75,9 +77,9 @@ public class ODataEntitySetIteratorRequestImpl
*/
@Override
@SuppressWarnings("unchecked")
- public ODataEntitySetIterator getBody() {
+ public ODataEntitySetIterator<ES, E> getBody() {
if (feedIterator == null) {
- feedIterator = new ODataEntitySetIterator(
+ feedIterator = new ODataEntitySetIterator<ES, E>(
odataClient, getRawResponse(), ODataPubFormat.fromString(getContentType()));
}
return feedIterator;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
index b32dd30..3943747 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
@@ -20,6 +20,7 @@ package org.apache.olingo.client.core.communication.request.retrieve.v3;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
@@ -28,6 +29,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkC
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetIteratorRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
@@ -62,6 +64,12 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
@SuppressWarnings("unchecked")
@Override
+ public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
+ return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
return new ODataEntityRequestImpl<ODataEntity>(client, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
index a32a153..96419c2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
@@ -20,6 +20,7 @@ package org.apache.olingo.client.core.communication.request.retrieve.v4;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
@@ -27,6 +28,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRe
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetIteratorRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
@@ -56,6 +58,12 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
@SuppressWarnings("unchecked")
@Override
+ public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
+ return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
return new ODataEntityRequestImpl<ODataEntity>(client, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 446b41d..0aaed01 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -18,6 +18,10 @@
*/
package org.apache.olingo.client.core.it.v3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
@@ -29,12 +33,10 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@@ -115,12 +117,12 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer");
- final ODataEntitySetIteratorRequest req =
+ final ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> req =
client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntitySetIterator> res = req.execute();
- final ODataEntitySetIterator feedIterator = res.getBody();
+ final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
+ final ODataEntitySetIterator<ODataEntitySet, ODataEntity> feedIterator = res.getBody();
assertNotNull(feedIterator);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index a73ce7a..c354a1d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -18,6 +18,10 @@
*/
package org.apache.olingo.client.core.it.v4;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
@@ -29,13 +33,10 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -124,11 +125,11 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("People");
- final ODataEntitySetIteratorRequest req =
+ final ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> req =
client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntitySetIterator> res = req.execute();
+ final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
final ODataEntitySetIterator feedIterator = res.getBody();
assertNotNull(feedIterator);
[46/51] [abbrv] git commit: [OLINGO-168] Tests for metadata
serialization
Posted by sk...@apache.org.
[OLINGO-168] Tests for metadata serialization
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/809519f9
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/809519f9
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/809519f9
Branch: refs/heads/olingo-206-validator
Commit: 809519f9d8baa8522d73dfcb7a590c4373480f93
Parents: 1e8eaec
Author: Christian Amend <ch...@apache.org>
Authored: Wed Apr 2 17:21:18 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Wed Apr 2 17:21:48 2014 +0200
----------------------------------------------------------------------
.../core/edm/AbstractEdmComplexType.java | 63 +++---
.../commons/core/edm/AbstractEdmEntityType.java | 16 +-
.../core/edm/AbstractEdmNavigationProperty.java | 17 +-
.../core/edm/AbstractEdmStructuredType.java | 194 +++++++++---------
.../olingo/commons/core/edm/EdmTypeImpl.java | 45 +++--
.../core/edm/provider/EdmComplexTypeImpl.java | 2 -
.../core/edm/provider/EdmEntityTypeImpl.java | 45 +++--
.../edm/provider/EdmComplexTypeImplTest.java | 12 +-
.../edm/provider/EdmEntityTypeImplTest.java | 11 +-
.../core/edm/provider/EdmSchemaImplTest.java | 6 +-
.../serializer/xml/MetadataDocumentTest.java | 197 ++++++++++++++++++-
11 files changed, 416 insertions(+), 192 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
index 732f29f..5410582 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -27,29 +27,36 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public abstract class AbstractEdmComplexType extends AbstractEdmStructuredType implements EdmComplexType {
- public AbstractEdmComplexType(
- final Edm edm,
- final FullQualifiedName fqn,
- final FullQualifiedName baseTypeName) {
- super(edm, fqn, EdmTypeKind.COMPLEX, baseTypeName);
- }
+ public AbstractEdmComplexType(
+ final Edm edm,
+ final FullQualifiedName typeName,
+ final FullQualifiedName baseTypeName) {
+ super(edm, typeName, EdmTypeKind.COMPLEX, baseTypeName);
+ }
- @Override
- protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
- // TODO: check for comment
- EdmComplexType baseType = null;
- if (baseTypeName != null) {
- baseType = edm.getComplexType(baseTypeName);
- if (baseType == null) {
- throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: "
- + getName());
- }
- }
- return baseType;
+ @Override
+ protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
+ EdmComplexType baseType = null;
+ if (baseTypeName != null) {
+ baseType = edm.getComplexType(baseTypeName);
+ if (baseType == null) {
+ throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: "
+ + getName());
+ }
}
+ return baseType;
+ }
+
+ @Override
+ public EdmComplexType getBaseType() {
+ checkBaseType();
+ return (EdmComplexType) baseType;
+ }
- @Override
- public EdmComplexType getBaseType() {
- return (EdmComplexType) baseType;
+ @Override
+ protected void checkBaseType() {
+ if (baseTypeName != null && baseType == null) {
+ baseType = buildBaseType(baseTypeName);
}
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
index eb9d170..60af07a 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
@@ -34,19 +34,15 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType implements EdmEntityType {
private final boolean hasStream;
-
protected EdmEntityType entityBaseType;
-
private final List<String> keyPredicateNames = new ArrayList<String>();
-
private final Map<String, EdmKeyPropertyRef> keyPropertyRefs = new LinkedHashMap<String, EdmKeyPropertyRef>();
-
private List<EdmKeyPropertyRef> keyPropertyRefsList;
- protected AbstractEdmEntityType(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
+ protected AbstractEdmEntityType(final Edm edm, final FullQualifiedName typeName, final FullQualifiedName baseTypeName,
final boolean hashStream) {
- super(edm, fqn, EdmTypeKind.ENTITY, baseTypeName);
+ super(edm, typeName, EdmTypeKind.ENTITY, baseTypeName);
this.hasStream = hashStream;
}
@@ -76,11 +72,13 @@ public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType im
@Override
public EdmEntityType getBaseType() {
+ checkBaseType();
return entityBaseType;
}
@Override
public List<String> getKeyPredicateNames() {
+ checkBaseType();
if (keyPredicateNames.isEmpty() && baseType != null) {
return entityBaseType.getKeyPredicateNames();
}
@@ -89,6 +87,7 @@ public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType im
@Override
public List<EdmKeyPropertyRef> getKeyPropertyRefs() {
+ checkBaseType();
if (keyPropertyRefsList == null) {
keyPropertyRefsList = new ArrayList<EdmKeyPropertyRef>(keyPropertyRefs.values());
}
@@ -100,6 +99,7 @@ public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType im
@Override
public EdmKeyPropertyRef getKeyPropertyRef(final String keyPredicateName) {
+ checkBaseType();
final EdmKeyPropertyRef edmKeyPropertyRef = keyPropertyRefs.get(keyPredicateName);
if (edmKeyPropertyRef == null && entityBaseType != null) {
return entityBaseType.getKeyPropertyRef(keyPredicateName);
@@ -111,4 +111,8 @@ public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType im
public boolean hasStream() {
return hasStream;
}
+
+ protected void checkBaseType() {
+ //Current Client implementation doesn`t need this so I implemented an empty body here.
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
index dca80bd..0d97ba6 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -62,7 +62,8 @@ public abstract class AbstractEdmNavigationProperty extends EdmElementImpl imple
for (String element : split) {
property = type.getNavigationProperty(element);
if (property == null) {
- throw new EdmException("Cannot find property with name: " + element + " at type " + type.getName());
+ throw new EdmException("Cannot find navigation property with name: " + element
+ + " at type " + type.getName());
}
type = (EdmStructuredType) property.getType();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
index a807052..a4cd47d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -34,99 +34,105 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
- protected EdmStructuredType baseType;
-
- private List<String> propertyNames;
-
- private List<String> navigationPropertyNames;
-
- public AbstractEdmStructuredType(
- final Edm edm,
- final FullQualifiedName fqn,
- final EdmTypeKind kind,
- final FullQualifiedName baseTypeName) {
-
- super(edm, fqn, kind);
+ protected EdmStructuredType baseType;
+ protected FullQualifiedName baseTypeName;
+ private List<String> propertyNames;
+ private List<String> navigationPropertyNames;
+
+ public AbstractEdmStructuredType(
+ final Edm edm,
+ final FullQualifiedName typeName,
+ final EdmTypeKind kind,
+ final FullQualifiedName baseTypeName) {
+
+ super(edm, typeName, kind);
+ this.baseTypeName = baseTypeName;
+ }
+
+ protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
+
+ protected abstract Map<String, EdmProperty> getProperties();
+
+ protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
+
+ protected abstract void checkBaseType();
+
+ @Override
+ public List<String> getPropertyNames() {
+ if (propertyNames == null) {
+ propertyNames = new ArrayList<String>();
+ checkBaseType();
+ if (baseType != null) {
+ propertyNames.addAll(baseType.getPropertyNames());
+ }
+ propertyNames.addAll(getProperties().keySet());
}
-
- protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
-
- protected abstract Map<String, EdmProperty> getProperties();
-
- protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
-
- @Override
- public List<String> getPropertyNames() {
- if (propertyNames == null) {
- propertyNames = new ArrayList<String>();
- if (baseType != null) {
- propertyNames.addAll(baseType.getPropertyNames());
- }
- propertyNames.addAll(getProperties().keySet());
- }
- return propertyNames;
+ return propertyNames;
+ }
+
+ @Override
+ public List<String> getNavigationPropertyNames() {
+ if (navigationPropertyNames == null) {
+ navigationPropertyNames = new ArrayList<String>();
+ checkBaseType();
+ if (baseType != null) {
+ navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
+ }
+ navigationPropertyNames.addAll(getNavigationProperties().keySet());
}
-
- @Override
- public List<String> getNavigationPropertyNames() {
- if (navigationPropertyNames == null) {
- navigationPropertyNames = new ArrayList<String>();
- if (baseType != null) {
- navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
- }
- navigationPropertyNames.addAll(getNavigationProperties().keySet());
- }
- return navigationPropertyNames;
+ return navigationPropertyNames;
+ }
+
+ @Override
+ public EdmElement getProperty(final String name) {
+ EdmElement property = getStructuralProperty(name);
+ if (property == null) {
+ property = getNavigationProperty(name);
}
-
- @Override
- public EdmElement getProperty(final String name) {
- EdmElement property = getStructuralProperty(name);
- if (property == null) {
- property = getNavigationProperty(name);
- }
- return property;
+ return property;
+ }
+
+ @Override
+ public EdmProperty getStructuralProperty(final String name) {
+ EdmProperty property = null;
+ checkBaseType();
+ if (baseType != null) {
+ property = baseType.getStructuralProperty(name);
}
-
- @Override
- public EdmProperty getStructuralProperty(final String name) {
- EdmProperty property = null;
- if (baseType != null) {
- property = baseType.getStructuralProperty(name);
- }
- if (property == null) {
- property = getProperties().get(name);
- }
- return property;
+ if (property == null) {
+ property = getProperties().get(name);
}
-
- @Override
- public EdmNavigationProperty getNavigationProperty(final String name) {
- EdmNavigationProperty property = null;
- if (baseType != null) {
- property = baseType.getNavigationProperty(name);
- }
- if (property == null) {
- property = getNavigationProperties().get(name);
- }
- return property;
+ return property;
+ }
+
+ @Override
+ public EdmNavigationProperty getNavigationProperty(final String name) {
+ EdmNavigationProperty property = null;
+ checkBaseType();
+ if (baseType != null) {
+ property = baseType.getNavigationProperty(name);
}
+ if (property == null) {
+ property = getNavigationProperties().get(name);
+ }
+ return property;
+ }
+
+ @Override
+ public boolean compatibleTo(final EdmType targetType) {
+ EdmStructuredType sourceType = this;
+ if (targetType == null) {
+ throw new EdmException("Target type must not be null");
+ }
+ while (!sourceType.getName().equals(targetType.getName())
+ || !sourceType.getNamespace().equals(targetType.getNamespace())) {
- @Override
- public boolean compatibleTo(final EdmType targetType) {
- EdmStructuredType sourceType = this;
- if (targetType == null) {
- throw new EdmException("Target type must not be null");
- }
- while (!sourceType.getName().equals(targetType.getName())
- || !sourceType.getNamespace().equals(targetType.getNamespace())) {
-
- sourceType = sourceType.getBaseType();
- if (sourceType == null) {
- return false;
- }
- }
-
- return true;
+ sourceType = sourceType.getBaseType();
+ if (sourceType == null) {
+ return false;
+ }
}
+
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
index ed20afa..6b9e7cb 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -25,23 +25,22 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public class EdmTypeImpl extends EdmNamedImpl implements EdmType {
- protected final FullQualifiedName fqn;
+ protected final FullQualifiedName typeName;
+ protected final EdmTypeKind kind;
- protected final EdmTypeKind kind;
+ public EdmTypeImpl(final Edm edm, final FullQualifiedName typeName, final EdmTypeKind kind) {
+ super(edm, typeName.getName());
+ this.typeName = typeName;
+ this.kind = kind;
+ }
- public EdmTypeImpl(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
- super(edm, fqn.getName());
- this.fqn = fqn;
- this.kind = kind;
- }
+ @Override
+ public String getNamespace() {
+ return typeName.getNamespace();
+ }
- @Override
- public String getNamespace() {
- return fqn.getNamespace();
- }
-
- @Override
- public EdmTypeKind getKind() {
- return kind;
- }
+ @Override
+ public EdmTypeKind getKind() {
+ return kind;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
index c818c58..34df670 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
@@ -36,8 +36,6 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
final EdmComplexTypeImpl instance = new EdmComplexTypeImpl(edm, name, complexType);
- instance.baseType = instance.buildBaseType(complexType.getBaseType());
-
return instance;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
index 774af98..021d3bd 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
@@ -36,34 +36,19 @@ import org.apache.olingo.server.api.edm.provider.PropertyRef;
public class EdmEntityTypeImpl extends AbstractEdmEntityType {
private final EdmStructuredTypeHelper helper;
+ private EntityType entityType;
+ private boolean baseTypeChecked = false;
public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName name,
final EntityType entityType) {
final EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, name, entityType);
- instance.baseType = instance.buildBaseType(entityType.getBaseType());
-
- if (instance.baseType == null) {
- instance.entityBaseType = null;
-
- final List<PropertyRef> key = entityType.getKey();
- if (key != null) {
- final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>();
- for (PropertyRef ref : key) {
- edmKey.add(new EdmKeyPropertyRefImpl(instance, ref));
- }
- instance.setEdmKeyPropertyRef(edmKey);
- }
- } else {
- instance.entityBaseType = (EdmEntityType) instance.baseType;
- }
-
return instance;
}
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
super(edm, name, entityType.getBaseType(), entityType.hasStream());
-
+ this.entityType = entityType;
helper = new EdmStructuredTypeHelperImpl(edm, entityType);
}
@@ -77,4 +62,28 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
return helper.getNavigationProperties();
}
+ @Override
+ protected void checkBaseType() {
+ if (!baseTypeChecked) {
+ if (baseTypeName != null) {
+ baseType = buildBaseType(baseTypeName);
+ }
+ if (baseType == null) {
+ entityBaseType = null;
+
+ final List<PropertyRef> key = entityType.getKey();
+ if (key != null) {
+ final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>();
+ for (PropertyRef ref : key) {
+ edmKey.add(new EdmKeyPropertyRefImpl(this, ref));
+ }
+ setEdmKeyPropertyRef(edmKey);
+ }
+ } else {
+ entityBaseType = (EdmEntityType) baseType;
+ }
+ baseTypeChecked = true;
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
index 5db5e98..cc3586d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
@@ -59,7 +59,7 @@ public class EdmComplexTypeImplTest {
List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>();
baseNavigationProperties.add(new NavigationProperty().setName("nav1"));
baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties)
- .setNavigationProperties(baseNavigationProperties);
+ .setNavigationProperties(baseNavigationProperties);
when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
baseType = EdmComplexTypeImpl.getInstance(edm, baseName, baseComplexType);
@@ -71,7 +71,7 @@ public class EdmComplexTypeImplTest {
List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
navigationProperties.add(new NavigationProperty().setName("nav2"));
complexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(properties)
- .setNavigationProperties(navigationProperties);
+ .setNavigationProperties(navigationProperties);
when(provider.getComplexType(name)).thenReturn(complexType);
type = EdmComplexTypeImpl.getInstance(edm, name, complexType);
@@ -155,10 +155,12 @@ public class EdmComplexTypeImplTest {
EdmProvider provider = mock(EdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
FullQualifiedName typeWithNonexistingBaseTypeName = new FullQualifiedName("namespace", "typeName");
- ComplexType complexTypeForNonexistingBaseType
- = new ComplexType().setBaseType(new FullQualifiedName("wrong", "wrong"));
+ ComplexType complexTypeForNonexistingBaseType =
+ new ComplexType().setBaseType(new FullQualifiedName("wrong", "wrong"));
complexTypeForNonexistingBaseType.setName("typeName");
when(provider.getComplexType(typeWithNonexistingBaseTypeName)).thenReturn(complexTypeForNonexistingBaseType);
- EdmComplexTypeImpl.getInstance(edm, typeWithNonexistingBaseTypeName, complexTypeForNonexistingBaseType);
+ EdmComplexTypeImpl instance =
+ EdmComplexTypeImpl.getInstance(edm, typeWithNonexistingBaseTypeName, complexTypeForNonexistingBaseType);
+ instance.getBaseType();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
index eeb8313..91a6018 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
@@ -96,21 +96,21 @@ public class EdmEntityTypeImplTest {
typeWithComplexKeyProvider.setName(typeWithComplexKeyName.getName());
List<Property> typeWithComplexKeyProperties = new ArrayList<Property>();
typeWithComplexKeyProperties.add(new Property().setName("Id").setType(
- EdmPrimitiveTypeKind.String.getFullQualifiedName()));
+ EdmPrimitiveTypeKind.String.getFullQualifiedName()));
List<Property> complexTypeProperties = new ArrayList<Property>();
complexTypeProperties.add(new Property().setName("ComplexPropName").setType(
- EdmPrimitiveTypeKind.String.getFullQualifiedName()));
+ EdmPrimitiveTypeKind.String.getFullQualifiedName()));
FullQualifiedName complexTypeName = new FullQualifiedName("namespace", "complexTypeName");
when(provider.getComplexType(complexTypeName)).thenReturn(
- new ComplexType().setName("complexTypeName").setProperties(complexTypeProperties));
+ new ComplexType().setName("complexTypeName").setProperties(complexTypeProperties));
typeWithComplexKeyProperties.add(new Property().setName("Comp").setType(complexTypeName));
typeWithComplexKeyProvider.setProperties(typeWithComplexKeyProperties);
List<PropertyRef> keyForTypeWithComplexKey = new ArrayList<PropertyRef>();
keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("Id"));
keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("ComplexPropName").setAlias("alias").setPath(
- "Comp/ComplexPropName"));
+ "Comp/ComplexPropName"));
typeWithComplexKeyProvider.setKey(keyForTypeWithComplexKey);
when(provider.getEntityType(typeWithComplexKeyName)).thenReturn(typeWithComplexKeyProvider);
@@ -255,7 +255,8 @@ public class EdmEntityTypeImplTest {
public void invalidBaseType() {
EdmProviderImpl edm = mock(EdmProviderImpl.class);
EntityType entityType = new EntityType().setName("n").setBaseType(new FullQualifiedName("wrong", "wrong"));
- EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), entityType);
+ EdmEntityTypeImpl instance = EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), entityType);
+ instance.getBaseType();
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
index f227796..5575fef 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
@@ -322,12 +322,14 @@ public class EdmSchemaImplTest {
List<EntityType> entityTypes = new ArrayList<EntityType>();
entityTypes.add(new EntityType().setName("entityType1"));
- entityTypes.add(new EntityType().setName("entityType2"));
+ entityTypes.add(new EntityType().setName("entityType2")
+ .setBaseType(new FullQualifiedName("namespace", "entityType1")));
providerSchema.setEntityTypes(entityTypes);
List<ComplexType> complexTypes = new ArrayList<ComplexType>();
complexTypes.add(new ComplexType().setName("complexType1"));
- complexTypes.add(new ComplexType().setName("complexType2"));
+ complexTypes.add(new ComplexType().setName("complexType2").setBaseType(
+ new FullQualifiedName("namespace", "complexType1")));
providerSchema.setComplexTypes(complexTypes);
List<Action> actions = new ArrayList<Action>();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/809519f9/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
index 9d08914..6a19364 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
@@ -18,13 +18,41 @@
*/
package org.apache.olingo.server.core.serializer.xml;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.server.api.ODataServer;
+import org.apache.olingo.server.api.edm.provider.Action;
+import org.apache.olingo.server.api.edm.provider.ActionImport;
+import org.apache.olingo.server.api.edm.provider.ComplexType;
+import org.apache.olingo.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.server.api.edm.provider.EntityContainer;
+import org.apache.olingo.server.api.edm.provider.EntitySet;
+import org.apache.olingo.server.api.edm.provider.EntityType;
+import org.apache.olingo.server.api.edm.provider.EnumMember;
+import org.apache.olingo.server.api.edm.provider.EnumType;
+import org.apache.olingo.server.api.edm.provider.Function;
+import org.apache.olingo.server.api.edm.provider.FunctionImport;
+import org.apache.olingo.server.api.edm.provider.NavigationProperty;
+import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding;
+import org.apache.olingo.server.api.edm.provider.Parameter;
+import org.apache.olingo.server.api.edm.provider.Property;
+import org.apache.olingo.server.api.edm.provider.ReturnType;
+import org.apache.olingo.server.api.edm.provider.Schema;
+import org.apache.olingo.server.api.edm.provider.Singleton;
+import org.apache.olingo.server.api.edm.provider.TypeDefinition;
import org.apache.olingo.server.api.serializer.ODataFormat;
import org.apache.olingo.server.api.serializer.ODataSerializer;
import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
@@ -48,10 +76,177 @@ public class MetadataDocumentTest {
}
@Test
+ public void writeMetadataWithLocalTestEdm() {
+ ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML);
+ Edm edm = new EdmProviderImpl(new TestMetadataProvider());
+ InputStream metadata = serializer.metadataDocument(edm);
+ assertNotNull(metadata);
+ String metadataString = StringUtils.inputStreamToString(metadata, false);
+ assertTrue(metadataString
+ .contains("<edmx:Edmx Version=\"4.0\" xmlns:edmx=\"http://docs.oasis-open.org/odata/ns/edmx\">"));
+
+ assertTrue(metadataString
+ .contains("<Schema xmlns=\"http://docs.oasis-open.org/odata/ns/edm\" " +
+ "Namespace=\"namespace\" Alias=\"alias\">"));
+
+ assertTrue(metadataString
+ .contains("<EntityType Name=\"ETBaseName\"><Property Name=\"P1\" Type=\"Edm.Int16\"/><NavigationProperty " +
+ "Name=\"N1\" Type=\"namespace.ETBaseName\" Nullable=\"true\" Partner=\"N1\"/></EntityType>"));
+
+ assertTrue(metadataString
+ .contains("<EntityType Name=\"ETDerivedName\" BaseType=\"namespace.ETBaseName\"><Property Name=\"P2\" " +
+ "Type=\"Edm.Int16\"/><NavigationProperty Name=\"N2\" Type=\"namespace.ETDerivedName\" Nullable=\"true\" " +
+ "Partner=\"N2\"/></EntityType>"));
+
+ assertTrue(metadataString
+ .contains("<ComplexType Name=\"CTBaseName\"><Property Name=\"P1\" Type=\"Edm.Int16\"/><NavigationProperty " +
+ "Name=\"N1\" Type=\"namespace.ETBaseName\" Nullable=\"true\" Partner=\"N1\"/></ComplexType>"));
+
+ assertTrue(metadataString
+ .contains("<ComplexType Name=\"CTDerivedName\" BaseType=\"namespace.CTBaseName\"><Property Name=\"P2\" " +
+ "Type=\"Edm.Int16\"/><NavigationProperty Name=\"N2\" Type=\"namespace.ETDerivedName\" Nullable=\"true\" " +
+ "Partner=\"N2\"/></ComplexType>"));
+
+ assertTrue(metadataString.contains("<TypeDefinition Name=\"typeDef\" Type=\"Edm.Int16\"/>"));
+
+ assertTrue(metadataString.contains("<Action Name=\"ActionWOParameter\" IsBound=\"false\"/>"));
+
+ assertTrue(metadataString
+ .contains("<Action Name=\"ActionName\" IsBound=\"true\"><Parameter Name=\"param\" Type=\"Edm.Int16\"/>" +
+ "<Parameter Name=\"param2\" Type=\"Collection(Edm.Int16)\"/><ReturnType Type=\"namespace.CTBaseName\"/>" +
+ "</Action>"));
+
+ assertTrue(metadataString
+ .contains("<Function Name=\"FunctionWOParameter\" IsBound=\"false\" IsComposable=\"false\"><ReturnType " +
+ "Type=\"namespace.CTBaseName\"/></Function>"));
+
+ assertTrue(metadataString
+ .contains("<Function Name=\"FunctionName\" IsBound=\"true\" IsComposable=\"false\"><Parameter Name=\"param\" " +
+ "Type=\"Edm.Int16\"/><Parameter Name=\"param2\" Type=\"Collection(Edm.Int16)\"/><ReturnType " +
+ "Type=\"namespace.CTBaseName\"/></Function>"));
+
+ assertTrue(metadataString.contains("<EntityContainer Name=\"container\">"));
+
+ assertTrue(metadataString
+ .contains("<EntitySet Name=\"EntitySetName\" EntityType=\"namespace.ETBaseName\"><NavigationPropertyBinding " +
+ "Path=\"N1\" Target=\"namespace.container/EntitySetName\"/></EntitySet>"));
+ assertTrue(metadataString
+ .contains("<Singleton Name=\"SingletonName\" EntityType=\"namespace.ETBaseName\"><NavigationPropertyBinding " +
+ "Path=\"N1\" Target=\"namespace.container/EntitySetName\"/></Singleton>"));
+
+ assertTrue(metadataString.contains("<ActionImport Name=\"actionImport\" Action=\"namespace.ActionWOParameter\"/>"));
+
+ assertTrue(metadataString
+ .contains("<FunctionImport Name=\"actionImport\" Function=\"namespace.FunctionName\" " +
+ "EntitySet=\"namespace.EntitySetName\" IncludeInServiceDocument=\"false\"/>"));
+
+ assertTrue(metadataString.contains("</EntityContainer></Schema></edmx:DataServices></edmx:Edmx>"));
+ }
+
+ @Test
public void writeMetadataWithTechnicalScenario() {
ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML);
EdmProviderImpl edm = new EdmProviderImpl(new EdmTechProvider());
InputStream metadata = serializer.metadataDocument(edm);
- StringUtils.inputStreamToString(metadata, false);
+ assertNotNull(metadata);
+ // The technical scenario is too big to verify. We are content for now to make sure we can serialize it.
+ // System.out.println(StringUtils.inputStreamToString(metadata, false));
+ }
+
+ private class TestMetadataProvider extends EdmProvider {
+
+ @Override
+ public List<Schema> getSchemas() throws ODataException {
+ Property p1 = new Property().setName("P1").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName());
+ String ns = "namespace";
+ NavigationProperty n1 = new NavigationProperty().setName("N1")
+ .setType(new FullQualifiedName(ns, "ETBaseName")).setNullable(true).setPartner("N1");
+ Property p2 = new Property().setName("P2").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName());
+ NavigationProperty n2 = new NavigationProperty().setName("N2")
+ .setType(new FullQualifiedName(ns, "ETDerivedName")).setNullable(true).setPartner("N2");
+ Schema schema = new Schema().setNamespace(ns).setAlias("alias");
+ List<ComplexType> complexTypes = new ArrayList<ComplexType>();
+ schema.setComplexTypes(complexTypes);
+ ComplexType ctBase =
+ new ComplexType().setName("CTBaseName").setProperties(Arrays.asList(p1)).setNavigationProperties(
+ Arrays.asList(n1));
+ complexTypes.add(ctBase);
+ ComplexType ctDerived =
+ new ComplexType().setName("CTDerivedName").setBaseType(new FullQualifiedName(ns, "CTBaseName"))
+ .setProperties(Arrays.asList(p2)).setNavigationProperties(Arrays.asList(n2));
+ complexTypes.add(ctDerived);
+
+ List<EntityType> entityTypes = new ArrayList<EntityType>();
+ schema.setEntityTypes(entityTypes);
+ EntityType etBase =
+ new EntityType().setName("ETBaseName").setProperties(Arrays.asList(p1)).setNavigationProperties(
+ Arrays.asList(n1));
+ entityTypes.add(etBase);
+ EntityType etDerived =
+ new EntityType().setName("ETDerivedName").setBaseType(new FullQualifiedName(ns, "ETBaseName"))
+ .setProperties(Arrays.asList(p2)).setNavigationProperties(Arrays.asList(n2));
+ entityTypes.add(etDerived);
+
+ List<Action> actions = new ArrayList<Action>();
+ schema.setActions(actions);
+ // TODO:EntitySetPath
+ actions.add((new Action().setName("ActionWOParameter")));
+ List<Parameter> parameters = new ArrayList<Parameter>();
+ parameters.add(new Parameter().setName("param").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()));
+ parameters.add(new Parameter().setName("param2").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
+ .setCollection(true));
+ actions.add(new Action().setName("ActionName").setBound(true).setParameters(parameters).setReturnType(
+ new ReturnType().setType(new FullQualifiedName(ns, "CTBaseName"))));
+
+ List<Function> functions = new ArrayList<Function>();
+ schema.setFunctions(functions);
+ functions.add((new Function().setName("FunctionWOParameter")
+ .setReturnType(new ReturnType().setType(new FullQualifiedName(ns, "CTBaseName")))));
+ functions.add(new Function().setName("FunctionName").setBound(true).setParameters(parameters).setReturnType(
+ new ReturnType().setType(new FullQualifiedName(ns, "CTBaseName"))));
+
+ List<EnumType> enumTypes = new ArrayList<EnumType>();
+ schema.setEnumTypes(enumTypes);
+ List<EnumMember> members = new ArrayList<EnumMember>();
+ members.add(new EnumMember().setName("member").setValue("1"));
+ enumTypes.add(new EnumType().setName("EnumName").setFlags(true).setMembers(members));
+
+ List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();
+ schema.setTypeDefinitions(typeDefinitions);
+ typeDefinitions.add(new TypeDefinition().setName("typeDef")
+ .setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()));
+
+ EntityContainer container = new EntityContainer().setName("container");
+ schema.setEntityContainer(container);
+
+ List<ActionImport> actionImports = new ArrayList<ActionImport>();
+ container.setActionImports(actionImports);
+ actionImports.add(new ActionImport().setName("actionImport").setAction(
+ new FullQualifiedName(ns, "ActionWOParameter")).setEntitySet(
+ new Target().setEntityContainer(new FullQualifiedName(ns, "container")).setTargetName("EntitySetName")));
+
+ List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
+ container.setFunctionImports(functionImports);
+ functionImports.add(new FunctionImport().setName("actionImport").setFunction(
+ new FullQualifiedName(ns, "FunctionName")).setEntitySet(
+ new Target().setEntityContainer(new FullQualifiedName(ns, "container")).setTargetName("EntitySetName")));
+
+ List<EntitySet> entitySets = new ArrayList<EntitySet>();
+ container.setEntitySets(entitySets);
+ List<NavigationPropertyBinding> nPB = new ArrayList<NavigationPropertyBinding>();
+ nPB.add(new NavigationPropertyBinding().setPath("N1").setTarget(
+ new Target().setEntityContainer(new FullQualifiedName(ns, "container")).setTargetName("EntitySetName")));
+ entitySets.add(new EntitySet().setName("EntitySetName").setType(new FullQualifiedName(ns, "ETBaseName"))
+ .setNavigationPropertyBindings(nPB));
+
+ List<Singleton> singletons = new ArrayList<Singleton>();
+ container.setSingletons(singletons);
+ singletons.add(new Singleton().setName("SingletonName").setType(new FullQualifiedName(ns, "ETBaseName"))
+ .setNavigationPropertyBindings(nPB));
+
+ List<Schema> schemas = new ArrayList<Schema>();
+ schemas.add(schema);
+ return schemas;
+ }
}
}
[49/51] [abbrv] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4
Posted by sk...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a6817f32
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a6817f32
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a6817f32
Branch: refs/heads/olingo-206-validator
Commit: a6817f32f84b3b125ab08088ca859d1518fa340d
Parents: 8888b05 aeb66aa
Author: fmartelli <fa...@gmail.com>
Authored: Thu Apr 3 10:58:54 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Apr 3 10:58:54 2014 +0200
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 14 +---
.../java/org/apache/olingo/fit/V3Services.java | 31 +++++++++
fit/src/main/resources/v3/openTypeMetadata.xml | 67 ++++++++++++++++++++
.../client/core/edm/EdmEntityContainerImpl.java | 13 ++--
.../client/core/edm/EdmEntityTypeImpl.java | 8 +++
.../olingo/client/core/edm/EdmSchemaImpl.java | 47 +++++++++++++-
.../apache/olingo/client/core/uri/URIUtils.java | 7 +-
.../client/core/it/v3/AbstractTestITCase.java | 6 +-
.../client/core/it/v3/OpenTypeTestITCase.java | 17 ++---
.../commons/api/edm/EdmEntityContainer.java | 23 +++++--
.../olingo/commons/api/edm/EdmEntityType.java | 11 +++-
.../olingo/commons/api/edm/EdmSchema.java | 36 ++++++++---
.../core/edm/AbstractEdmEntityContainer.java | 16 ++++-
.../commons/core/edm/AbstractEdmEntityType.java | 7 +-
.../commons/core/edm/AbstractEdmSchemaImpl.java | 26 ++++++++
.../core/edm/provider/EdmEntityTypeImpl.java | 11 +++-
16 files changed, 284 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
[15/51] [abbrv] git commit: [OLINGO-200] V4 ODataValue full reachable
via API
Posted by sk...@apache.org.
[OLINGO-200] V4 ODataValue full reachable via API
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/dc2922c9
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/dc2922c9
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/dc2922c9
Branch: refs/heads/olingo-206-validator
Commit: dc2922c956fd4570353130ae1407cab4fd4846f0
Parents: 117cf6f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 10:59:35 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 10:59:35 2014 +0200
----------------------------------------------------------------------
.../request/cud/CommonCUDRequestFactory.java | 3 +-
.../request/cud/ODataEntityCreateRequest.java | 8 +-
.../request/retrieve/ODataEntitySetRequest.java | 8 +-
.../retrieve/v3/RetrieveRequestFactory.java | 5 +-
.../retrieve/v4/RetrieveRequestFactory.java | 1 -
.../response/ODataEntityCreateResponse.java | 7 +-
.../api/domain/ODataEntitySetIterator.java | 3 +
.../olingo/client/api/op/v3/ODataReader.java | 13 +
.../olingo/client/api/op/v4/ODataReader.java | 14 +
.../request/cud/AbstractCUDRequestFactory.java | 6 +-
.../cud/ODataEntityCreateRequestImpl.java | 25 +-
.../cud/ODataValueUpdateRequestImpl.java | 4 +-
.../retrieve/ODataEntitySetRequestImpl.java | 15 +-
.../request/retrieve/ODataValueRequestImpl.java | 4 +-
.../client/core/op/AbstractODataBinder.java | 29 +-
.../client/core/op/AbstractODataReader.java | 16 -
.../client/core/op/impl/v3/ODataBinderImpl.java | 22 +
.../client/core/op/impl/v3/ODataReaderImpl.java | 23 +
.../client/core/op/impl/v4/ODataBinderImpl.java | 25 +-
.../client/core/op/impl/v4/ODataReaderImpl.java | 25 +
.../core/it/AbstractMetadataTestITCase.java | 3 +-
.../client/core/it/AbstractTestITCase.java | 562 -------------------
.../client/core/it/v3/AbstractTestITCase.java | 530 ++++++++++++++++-
.../core/it/v3/EntityCreateTestITCase.java | 98 ++--
.../core/it/v3/EntityUpdateTestITCase.java | 21 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 13 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 89 +--
.../client/core/it/v3/OpenTypeTestITCase.java | 28 +-
.../client/core/it/v3/PropertyTestITCase.java | 14 +-
.../client/core/it/v4/AbstractTestITCase.java | 3 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 18 +-
.../client/core/it/v4/EntitySetTestITCase.java | 4 -
.../core/it/v4/PropertyValueTestITCase.java | 22 +-
.../olingo/client/core/v3/PropertyTest.java | 37 +-
.../olingo/client/core/v4/EntityTest.java | 16 +-
.../commons/api/domain/AbstractODataValue.java | 12 +-
.../api/domain/CommonODataObjectFactory.java | 8 +-
.../commons/api/domain/CommonODataProperty.java | 14 -
.../api/domain/ODataCollectionValue.java | 6 +-
.../commons/api/domain/ODataComplexValue.java | 8 +-
.../olingo/commons/api/domain/ODataValue.java | 6 +-
.../api/domain/v3/ODataObjectFactory.java | 12 +-
.../commons/api/domain/v3/ODataProperty.java | 16 +
.../api/domain/v4/ODataObjectFactory.java | 12 +-
.../commons/api/domain/v4/ODataProperty.java | 16 +
.../domain/AbstractODataCollectionValue.java | 93 +++
.../core/domain/AbstractODataComplexValue.java | 93 +++
.../core/domain/AbstractODataObjectFactory.java | 18 -
.../domain/AbstractODataPrimitiveValue.java | 179 ++++++
.../core/domain/AbstractODataProperty.java | 22 -
.../core/domain/ODataCollectionValueImpl.java | 90 ---
.../core/domain/ODataComplexValueImpl.java | 89 ---
.../core/domain/ODataPrimitiveValueImpl.java | 180 ------
.../domain/v3/ODataCollectionValueImpl.java | 32 ++
.../core/domain/v3/ODataComplexValueImpl.java | 32 ++
.../core/domain/v3/ODataObjectFactoryImpl.java | 25 +-
.../core/domain/v3/ODataPrimitiveValueImpl.java | 44 ++
.../core/domain/v3/ODataPropertyImpl.java | 12 +
.../domain/v4/ODataCollectionValueImpl.java | 42 ++
.../core/domain/v4/ODataComplexValueImpl.java | 44 ++
.../core/domain/v4/ODataObjectFactoryImpl.java | 25 +-
.../core/domain/v4/ODataPrimitiveValueImpl.java | 56 ++
.../core/domain/v4/ODataPropertyImpl.java | 13 +
pom.xml | 5 +
64 files changed, 1645 insertions(+), 1273 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
index f05eb1a..b6c74dd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
@@ -35,11 +35,12 @@ public interface CommonCUDRequestFactory extends Serializable {
* <br/>
* Use this kind of request to create a new entity.
*
+ * @param <E> concrete ODataEntity implementation
* @param targetURI entity set URI.
* @param entity entity to be created.
* @return new ODataEntityCreateRequest instance.
*/
- ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, CommonODataEntity entity);
+ <E extends CommonODataEntity> ODataEntityCreateRequest<E> getEntityCreateRequest(URI targetURI, E entity);
/**
* Gets an update request object instance.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
index 02f41e7..73471b9 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
@@ -20,10 +20,14 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
- * This class implements an OData create request.
+ * This interface describes an OData create request.
+ *
+ * @param <E> concrete ODataEntity implementation
*/
-public interface ODataEntityCreateRequest extends ODataBasicRequest<ODataEntityCreateResponse, ODataPubFormat>{
+public interface ODataEntityCreateRequest<E extends CommonODataEntity>
+ extends ODataBasicRequest<ODataEntityCreateResponse<E>, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
index 865596c..c7e1964 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
@@ -22,8 +22,10 @@ import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
- * This class implements an OData EntitySet query request.
+ * This interface describes an OData EntitySet query request.
+ *
+ * @param <ES> concrete ODataEntitySet implementation
*/
-public interface ODataEntitySetRequest<T extends CommonODataEntitySet>
- extends ODataRetrieveRequest<T, ODataPubFormat> {
+public interface ODataEntitySetRequest<ES extends CommonODataEntitySet>
+ extends ODataRetrieveRequest<ES, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
index 0d133cb..5adc932 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
@@ -28,21 +28,18 @@ import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+@SuppressWarnings("unchecked")
public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
- @SuppressWarnings("unchecked")
@Override
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
- @SuppressWarnings("unchecked")
@Override
ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
- @SuppressWarnings("unchecked")
@Override
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
- @SuppressWarnings("unchecked")
@Override
ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
index 63f3515..ab8dade 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
@@ -34,7 +34,6 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
@Override
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
- @SuppressWarnings("unchecked")
@Override
ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
index 0407422..678b894 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
@@ -21,16 +21,17 @@ package org.apache.olingo.client.api.communication.response;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
- * This class implements the response to an OData entity create request.
+ * This interface describes the response to an OData entity create request.
*
+ * @param <E> concrete ODataEntity implementation
* @see org.apache.olingo.client.core.communication.request.cud.ODataEntityCreateRequest
*/
-public interface ODataEntityCreateResponse extends ODataResponse {
+public interface ODataEntityCreateResponse<E extends CommonODataEntity> extends ODataResponse {
/**
* Gets created object.
*
* @return created object.
*/
- CommonODataEntity getBody();
+ E getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index dd77a44..107816f 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -41,6 +41,9 @@ import org.slf4j.LoggerFactory;
* OData entity set iterator class.
* <br/>
* <b>Please don't forget to call the <tt>close()>/<tt> method when not needed any more.</b>
+ *
+ * @param <E> concrete ODataEntity implementation
+ * @param <ES> concrete ODataEntitySet implementation
*/
public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends CommonODataEntity>
implements Iterator<E> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
index 7049617..2e72ce4 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
@@ -22,9 +22,22 @@ import java.io.InputStream;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public interface ODataReader extends CommonODataReader {
+ @Override
+ ODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
+
+ @Override
+ ODataEntity readEntity(InputStream input, ODataPubFormat format);
+
+ @Override
+ ODataProperty readProperty(InputStream input, ODataFormat format);
+
/**
* Parses a $links request response.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
index 25d989d..c976c05 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
@@ -18,8 +18,22 @@
*/
package org.apache.olingo.client.api.op.v4;
+import java.io.InputStream;
import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public interface ODataReader extends CommonODataReader {
+ @Override
+ ODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
+
+ @Override
+ ODataEntity readEntity(InputStream input, ODataPubFormat format);
+
+ @Override
+ ODataProperty readProperty(InputStream input, ODataFormat format);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
index ae55269..16eecad 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
@@ -46,8 +46,10 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
}
@Override
- public ODataEntityCreateRequest getEntityCreateRequest(final URI targetURI, final CommonODataEntity entity) {
- return new ODataEntityCreateRequestImpl(client, targetURI, entity);
+ public <E extends CommonODataEntity> ODataEntityCreateRequest<E> getEntityCreateRequest(
+ final URI targetURI, final E entity) {
+
+ return new ODataEntityCreateRequestImpl<E>(client, targetURI, entity);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index f8bff7e..18485ae 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -39,14 +39,17 @@ import org.apache.olingo.commons.api.data.Entry;
/**
* This class implements an OData create request.
+ *
+ * @param <E> concrete ODataEntity implementation
*/
-public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODataEntityCreateResponse, ODataPubFormat>
- implements ODataEntityCreateRequest, ODataBatchableRequest {
+public class ODataEntityCreateRequestImpl<E extends CommonODataEntity>
+ extends AbstractODataBasicRequest<ODataEntityCreateResponse<E>, ODataPubFormat>
+ implements ODataEntityCreateRequest<E>, ODataBatchableRequest {
/**
* Entity to be created.
*/
- private final CommonODataEntity entity;
+ private final E entity;
/**
* Constructor.
@@ -55,9 +58,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* @param targetURI entity set URI.
* @param entity entity to be created.
*/
- ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI,
- final CommonODataEntity entity) {
-
+ ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final E entity) {
super(odataClient, ODataPubFormat.class, HttpMethod.POST, targetURI);
this.entity = entity;
}
@@ -74,7 +75,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* {@inheritDoc }
*/
@Override
- public ODataEntityCreateResponse execute() {
+ public ODataEntityCreateResponse<E> execute() {
final InputStream input = getPayload();
((HttpPost) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
@@ -88,9 +89,9 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
/**
* Response class about an ODataEntityCreateRequest.
*/
- private class ODataEntityCreateResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse {
+ private class ODataEntityCreateResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse<E> {
- private CommonODataEntity entity = null;
+ private E entity = null;
/**
* Constructor.
@@ -98,6 +99,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* Just to create response templates to be initialized from batch.
*/
private ODataEntityCreateResponseImpl() {
+ super();
}
/**
@@ -114,13 +116,14 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* {@inheritDoc }
*/
@Override
- public CommonODataEntity getBody() {
+ @SuppressWarnings("unchecked")
+ public E getBody() {
if (entity == null) {
try {
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
ODataPubFormat.fromString(getAccept()));
- entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
+ entity = (E) odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index 5876f49..660f1e3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -35,7 +35,6 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
-import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
@@ -101,6 +100,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
* Just to create response templates to be initialized from batch.
*/
private ODataValueUpdateResponseImpl() {
+ super();
}
/**
@@ -122,7 +122,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
final ODataValueFormat format = ODataValueFormat.fromString(getAccept());
try {
- value = new ODataPrimitiveValueImpl.BuilderImpl(odataClient.getServiceVersion()).
+ value = odataClient.getObjectFactory().newPrimitiveValueBuilder().
setType(format == ODataValueFormat.TEXT
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(getRawResponse())).
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index 86fa45c..fb571e9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -31,11 +31,13 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
+ *
+ * @param <ES> concrete ODataEntitySet implementation
*/
-public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
- extends AbstractODataRetrieveRequest<T, ODataPubFormat> implements ODataEntitySetRequest<T> {
+public class ODataEntitySetRequestImpl<ES extends CommonODataEntitySet>
+ extends AbstractODataRetrieveRequest<ES, ODataPubFormat> implements ODataEntitySetRequest<ES> {
- private T entitySet = null;
+ private ES entitySet = null;
/**
* Private constructor.
@@ -51,7 +53,7 @@ public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<T> execute() {
+ public ODataRetrieveResponse<ES> execute() {
final HttpResponse res = doExecute();
return new ODataEntitySetResponseImpl(httpClient, res);
}
@@ -67,6 +69,7 @@ public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
* Just to create response templates to be initialized from batch.
*/
private ODataEntitySetResponseImpl() {
+ super();
}
/**
@@ -84,13 +87,13 @@ public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
*/
@Override
@SuppressWarnings("unchecked")
- public T getBody() {
+ public ES getBody() {
if (entitySet == null) {
try {
final Container<Feed> container =
odataClient.getDeserializer().toFeed(getRawResponse(), ODataPubFormat.fromString(getContentType()));
- entitySet = (T) odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
+ entitySet = (ES) odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index 2d7feed..cd8ca18 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -28,7 +28,6 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
@@ -69,6 +68,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPri
* Just to create response templates to be initialized from batch.
*/
private ODataValueResponseImpl() {
+ super();
}
/**
@@ -90,7 +90,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPri
final ODataValueFormat format = ODataValueFormat.fromString(getContentType());
try {
- value = new ODataPrimitiveValueImpl.BuilderImpl(odataClient.getServiceVersion()).
+ value = odataClient.getObjectFactory().newPrimitiveValueBuilder().
setType(format == ODataValueFormat.TEXT
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(getRawResponse())).
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 13a49fb..faed745 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -209,27 +209,6 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
return linkResource;
}
- @Override
- public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
- final boolean setType) {
-
- final Property propertyResource = ResourceFactory.newProperty(reference);
- propertyResource.setName(property.getName());
- propertyResource.setValue(getValue(property.getValue(), reference, setType));
-
- if (setType) {
- if (property.hasPrimitiveValue()) {
- propertyResource.setType(property.getPrimitiveValue().getType().toString());
- } else if (property.hasComplexValue()) {
- propertyResource.setType(property.getComplexValue().getTypeName());
- } else if (property.hasCollectionValue()) {
- propertyResource.setType(property.getCollectionValue().getTypeName());
- }
- }
-
- return propertyResource;
- }
-
protected Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
Value valueResource = null;
@@ -240,17 +219,17 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
? new GeospatialValueImpl((Geospatial) value.asPrimitive().toValue())
: new PrimitiveValueImpl(value.asPrimitive().toString());
} else if (value.isComplex()) {
- final ODataComplexValue _value = value.asComplex();
+ final ODataComplexValue<? extends CommonODataProperty> _value = value.asComplex();
valueResource = new ComplexValueImpl();
- for (final Iterator<CommonODataProperty> itor = _value.iterator(); itor.hasNext();) {
+ for (final Iterator<? extends CommonODataProperty> itor = _value.iterator(); itor.hasNext();) {
valueResource.asComplex().get().add(getProperty(itor.next(), reference, setType));
}
} else if (value.isCollection()) {
- final ODataCollectionValue _value = value.asCollection();
+ final ODataCollectionValue<? extends ODataValue> _value = value.asCollection();
valueResource = new CollectionValueImpl();
- for (final Iterator<ODataValue> itor = _value.iterator(); itor.hasNext();) {
+ for (final Iterator<? extends ODataValue> itor = _value.iterator(); itor.hasNext();) {
valueResource.asCollection().get().add(getValue(itor.next(), reference, setType));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index 4ff36f9..b7d29f7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -78,22 +78,6 @@ public abstract class AbstractODataReader implements CommonODataReader {
}
@Override
- public CommonODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
- return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
- }
-
- @Override
- public CommonODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
- return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
- }
-
- @Override
- public CommonODataProperty readProperty(final InputStream input, final ODataFormat format) {
- final Property property = client.getDeserializer().toProperty(input, format).getObject();
- return client.getBinder().getODataProperty(property);
- }
-
- @Override
public ODataError readError(final InputStream inputStream, final boolean isXML) {
return client.getDeserializer().toError(inputStream, isXML);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
index 28887dc..50deadd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
@@ -34,6 +34,7 @@ import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.core.domain.v3.ODataPropertyImpl;
+import org.apache.olingo.commons.core.op.ResourceFactory;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -54,6 +55,27 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
+ final boolean setType) {
+
+ final Property propertyResource = ResourceFactory.newProperty(reference);
+ propertyResource.setName(property.getName());
+ propertyResource.setValue(getValue(property.getValue(), reference, setType));
+
+ if (setType) {
+ if (property.hasPrimitiveValue()) {
+ propertyResource.setType(property.getPrimitiveValue().getTypeName());
+ } else if (property.hasComplexValue()) {
+ propertyResource.setType(((ODataProperty) property).getComplexValue().getTypeName());
+ } else if (property.hasCollectionValue()) {
+ propertyResource.setType(((ODataProperty) property).getCollectionValue().getTypeName());
+ }
+ }
+
+ return propertyResource;
+ }
+
+ @Override
public ODataEntitySet getODataEntitySet(final Feed resource) {
return (ODataEntitySet) super.getODataEntitySet(resource);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index b9cf6de..8663e79 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -26,7 +26,12 @@ import org.apache.olingo.client.api.op.v3.ODataReader;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataReader;
import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
@@ -37,6 +42,24 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
}
@Override
+ public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
+ return ((ODataClient) client).getBinder().
+ getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
+ }
+
+ @Override
+ public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
+ return ((ODataClient) client).getBinder().
+ getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
+ }
+
+ @Override
+ public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
+ final Property property = client.getDeserializer().toProperty(input, format).getObject();
+ return ((ODataClient) client).getBinder().getODataProperty(property);
+ }
+
+ @Override
public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format) {
return ((ODataClient) client).getBinder().getLinkCollection(
((ODataClient) client).getDeserializer().toLinkCollection(input, format).getObject());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/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 e85b34e..4f4a484 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
@@ -21,11 +21,10 @@ package org.apache.olingo.client.core.op.impl.v4;
import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.op.v4.ODataBinder;
-import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataBinder;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Property;
@@ -33,6 +32,7 @@ import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
@@ -40,6 +40,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.core.data.EnumValueImpl;
import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.op.ResourceFactory;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -93,10 +94,24 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
final boolean setType) {
- final Property propertyResource = super.getProperty(property, reference, setType);
- if (property instanceof ODataProperty && ((ODataProperty) property).hasEnumValue() && setType) {
- propertyResource.setType(((ODataProperty) property).getEnumValue().getTypeName());
+ final ODataProperty _property = (ODataProperty) property;
+
+ final Property propertyResource = ResourceFactory.newProperty(reference);
+ propertyResource.setName(_property.getName());
+ propertyResource.setValue(getValue(_property.getValue(), reference, setType));
+
+ if (setType) {
+ if (_property.hasPrimitiveValue()) {
+ propertyResource.setType(_property.getPrimitiveValue().getTypeName());
+ } else if (_property.hasEnumValue()) {
+ propertyResource.setType(_property.getEnumValue().getTypeName());
+ } else if (_property.hasComplexValue()) {
+ propertyResource.setType(_property.getComplexValue().getTypeName());
+ } else if (_property.hasCollectionValue()) {
+ propertyResource.setType(_property.getCollectionValue().getTypeName());
+ }
}
+
return propertyResource;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index 9340963..41f1e3b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -18,9 +18,16 @@
*/
package org.apache.olingo.client.core.op.impl.v4;
+import java.io.InputStream;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataReader;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
@@ -29,4 +36,22 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
public ODataReaderImpl(final ODataClient client) {
super(client);
}
+
+ @Override
+ public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
+ return ((ODataClient) client).getBinder().
+ getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
+ }
+
+ @Override
+ public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
+ return ((ODataClient) client).getBinder().
+ getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
+ }
+
+ @Override
+ public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
+ final Property property = client.getDeserializer().toProperty(input, format).getObject();
+ return ((ODataClient) client).getBinder().getODataProperty(property);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
index 11b9104..4f65421 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
@@ -20,9 +20,8 @@ package org.apache.olingo.client.core.it;
import org.apache.olingo.client.api.CommonODataClient;
-public abstract class AbstractMetadataTestITCase extends AbstractTestITCase {
+public abstract class AbstractMetadataTestITCase {
- @Override
protected abstract CommonODataClient getClient();
protected String getTestServiceRoot() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
deleted file mode 100644
index 0a3b53d..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ /dev/null
@@ -1,562 +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.it;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Set;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
-import org.apache.olingo.client.api.communication.request.cud.UpdateType;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
-import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.junit.BeforeClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractTestITCase {
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractTestITCase.class);
-
- protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product";
-
- protected static final String servicesODataServiceRootURL =
- "http://services.odata.org/V3/(S(csquyjnoaywmz5xcdbfhlc1p))/OData/OData.svc/";
-
- /**
- * This is needed for correct number handling (Double, for example).
- */
- @BeforeClass
- public static void setEnglishLocale() {
- Locale.setDefault(Locale.ENGLISH);
- }
-
- protected abstract CommonODataClient getClient();
-
- protected void checkLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
- assertTrue(original.size() <= actual.size());
-
- for (ODataLink originalLink : original) {
- ODataLink foundOriginal = null;
- ODataLink foundActual = null;
-
- for (ODataLink actualLink : actual) {
-
- if (actualLink.getType() == originalLink.getType()
- && (originalLink.getLink() == null
- || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString()))
- && actualLink.getName().equals(originalLink.getName())) {
-
- foundOriginal = originalLink;
- foundActual = actualLink;
- }
- }
-
- assertNotNull(foundOriginal);
- assertNotNull(foundActual);
-
- if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
- final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
- assertNotNull(originalInline);
-
- final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
- assertNotNull(actualInline);
-
- checkProperties(originalInline.getProperties(), actualInline.getProperties());
- }
- }
- }
-
- protected void checkProperties(final Collection<? extends CommonODataProperty> original,
- final Collection<? extends CommonODataProperty> actual) {
-
- assertTrue(original.size() <= actual.size());
-
- // re-organize actual properties into a Map<String, ODataProperty>
- final Map<String, CommonODataProperty> actualProps = new HashMap<String, CommonODataProperty>(actual.size());
-
- for (CommonODataProperty prop : actual) {
- assertFalse(actualProps.containsKey(prop.getName()));
- actualProps.put(prop.getName(), prop);
- }
-
- assertTrue(actual.size() <= actualProps.size());
-
- for (CommonODataProperty prop : original) {
- assertNotNull(prop);
- if (actualProps.containsKey(prop.getName())) {
- final CommonODataProperty actualProp = actualProps.get(prop.getName());
- assertNotNull(actualProp);
-
- if (prop.getValue() != null && actualProp.getValue() != null) {
- checkPropertyValue(prop.getName(), prop.getValue(), actualProp.getValue());
- }
- } else {
- // nothing ... maybe :FC_KeepInContent="false"
- // ..... no assert can be done ....
- }
- }
- }
-
- protected void checkPropertyValue(final String propertyName,
- final ODataValue original, final ODataValue actual) {
-
- assertNotNull("Null original value for " + propertyName, original);
- assertNotNull("Null actual value for " + propertyName, actual);
-
- assertEquals("Type mismatch for '" + propertyName + "': "
- + original.getClass().getSimpleName() + "-" + actual.getClass().getSimpleName(),
- original.getClass().getSimpleName(), actual.getClass().getSimpleName());
-
- if (original.isComplex()) {
- final List<CommonODataProperty> originalFileds = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : original.asComplex()) {
- originalFileds.add(prop);
- }
-
- final List<CommonODataProperty> actualFileds = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : (ODataComplexValue) actual) {
- actualFileds.add(prop);
- }
-
- checkProperties(originalFileds, actualFileds);
- } else if (original.isCollection()) {
- assertTrue(original.asCollection().size() <= actual.asCollection().size());
-
- boolean found = original.asCollection().isEmpty();
-
- for (ODataValue originalValue : original.asCollection()) {
- for (ODataValue actualValue : actual.asCollection()) {
- try {
- checkPropertyValue(propertyName, originalValue, actualValue);
- found = true;
- } catch (AssertionError ignore) {
- // ignore
- }
- }
- }
-
- assertTrue("Found " + actual + " but expected " + original, found);
- } else {
- assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive().
- getTypeKind() + "-" + actual.asPrimitive().getTypeKind(),
- original.asPrimitive().getTypeKind().equals(actual.asPrimitive().getTypeKind()));
-
- assertEquals("Primitive value for '" + propertyName + "' mismatch: " + original.asPrimitive().toString()
- + "-" + actual.asPrimitive().toString(),
- original.asPrimitive().toString(), actual.asPrimitive().toString());
- }
- }
-
- protected CommonODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
- final CommonODataEntity entity = getClient().getObjectFactory().newEntity(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
- entity.setMediaEntity(true);
-
- getClient().getBinder().add(entity,
- getClient().getObjectFactory().newPrimitiveProperty("Information",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).
- setType(EdmPrimitiveTypeKind.String).build()));
-
- return entity;
- }
-
- protected CommonODataEntity getSampleCustomerProfile(
- final int id, final String sampleName, final boolean withInlineInfo) {
-
- final CommonODataEntity entity =
- getClient().getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
-
- // add name attribute
- getClient().getBinder().add(entity,
- getClient().getObjectFactory().newPrimitiveProperty("Name",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).
- setType(EdmPrimitiveTypeKind.String).build()));
-
- // add key attribute
- getClient().getBinder().add(entity,
- getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
- setType(EdmPrimitiveTypeKind.Int32).build()));
-
- // add BackupContactInfo attribute (collection)
- final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
- "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
- getClient().getBinder().add(entity,
- getClient().getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
-
- // add BackupContactInfo.ContactDetails attribute (complex)
- final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
- backupContactInfoValue.add(contactDetails);
-
- // add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
- final ODataCollectionValue altNamesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- altNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setText("myname").setType(EdmPrimitiveTypeKind.String).build());
- contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
-
- // add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
- final ODataCollectionValue emailBagValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- emailBagValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
- contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
-
- // add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
- final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
- contactDetails.add(getClient().getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
-
- // add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
- final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- aliasAltNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
- contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
-
- if (withInlineInfo) {
- final ODataInlineEntity inlineInfo = getClient().getObjectFactory().newInlineEntity(
- "Info",
- URI.create("Customer(" + id + ")/Info"),
- getSampleCustomerInfo(id, sampleName + "_Info"));
- inlineInfo.getEntity().setMediaEntity(true);
- entity.addLink(inlineInfo);
- }
-
- return entity;
- }
-
- protected void debugEntry(final Entry entry, final String message) {
- if (LOG.isDebugEnabled()) {
- final StringWriter writer = new StringWriter();
- getClient().getSerializer().entry(entry, writer);
- writer.flush();
- LOG.debug(message + "\n{}", writer.toString());
- }
- }
-
- protected void debugFeed(final Feed feed, final String message) {
- if (LOG.isDebugEnabled()) {
- final StringWriter writer = new StringWriter();
- getClient().getSerializer().feed(feed, writer);
- writer.flush();
- LOG.debug(message + "\n{}", writer.toString());
- }
- }
-
- protected void debugODataProperty(final CommonODataProperty property, final String message) {
- LOG.debug(message + "\n{}", property.toString());
- }
-
- protected void debugODataValue(final ODataValue value, final String message) {
- LOG.debug(message + "\n{}", value.toString());
- }
-
- protected void debugODataEntity(final CommonODataEntity entity, final String message) {
- if (LOG.isDebugEnabled()) {
- StringWriter writer = new StringWriter();
- getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, AtomEntryImpl.class), writer);
- writer.flush();
- LOG.debug(message + " (Atom)\n{}", writer.toString());
-
- writer = new StringWriter();
- getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, JSONEntryImpl.class), writer);
- writer.flush();
- LOG.debug(message + " (JSON)\n{}", writer.toString());
- }
- }
-
- protected void debugInputStream(final InputStream input, final String message) {
- if (LOG.isDebugEnabled()) {
- try {
- LOG.debug(message + "\n{}", IOUtils.toString(input));
- } catch (IOException e) {
- LOG.error("Error writing stream", e);
- } finally {
- IOUtils.closeQuietly(input);
- }
- }
- }
-
- protected String getETag(final URI uri) {
- final ODataRetrieveResponse<CommonODataEntity> res = getClient().getRetrieveRequestFactory().
- getEntityRequest(uri).execute();
- try {
- return res.getEtag();
- } finally {
- res.close();
- }
- }
-
- protected CommonODataEntity read(final ODataPubFormat format, final URI editLink) {
- final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().
- getEntityRequest(editLink);
- req.setFormat(format);
-
- final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
- final CommonODataEntity entity = res.getBody();
-
- assertNotNull(entity);
-
- if (ODataPubFormat.JSON_FULL_METADATA == format || ODataPubFormat.ATOM == format) {
- assertEquals(req.getURI(), entity.getEditLink());
- }
-
- return entity;
- }
-
- protected CommonODataEntity createEntity(
- final String serviceRootURL,
- final ODataPubFormat format,
- final CommonODataEntity original,
- final String entitySetName) {
-
- final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
- appendEntitySetSegment(entitySetName);
-
- debugODataEntity(original, "About to create");
-
- final ODataEntityCreateRequest createReq =
- getClient().getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
- createReq.setFormat(format);
-
- final ODataEntityCreateResponse createRes = createReq.execute();
- assertEquals(201, createRes.getStatusCode());
- assertEquals("Created", createRes.getStatusMessage());
-
- final CommonODataEntity created = createRes.getBody();
- assertNotNull(created);
-
- debugODataEntity(created, "Just created");
-
- return created;
- }
-
- protected CommonODataEntity compareEntities(final String serviceRootURL,
- final ODataPubFormat format,
- final CommonODataEntity original,
- final int actualObjectId,
- final Collection<String> expands) {
-
- final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
- appendEntitySetSegment("Customer").appendKeySegment(actualObjectId);
-
- // search expanded
- if (expands != null) {
- for (String expand : expands) {
- uriBuilder.expand(expand);
- }
- }
-
- final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().
- getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final CommonODataEntity actual = res.getBody();
- assertNotNull(actual);
-
- // check defined links
- checkLinks(original.getAssociationLinks(), actual.getAssociationLinks());
- checkLinks(original.getEditMediaLinks(), actual.getEditMediaLinks());
- checkLinks(original.getNavigationLinks(), actual.getNavigationLinks());
-
- // check defined properties equality
- checkProperties(original.getProperties(), actual.getProperties());
-
- return actual;
- }
-
- protected void cleanAfterCreate(
- final ODataPubFormat format,
- final CommonODataEntity created,
- final boolean includeInline,
- final String baseUri) {
-
- final Set<URI> toBeDeleted = new HashSet<URI>();
- toBeDeleted.add(created.getEditLink());
-
- if (includeInline) {
- for (ODataLink link : created.getNavigationLinks()) {
- if (link instanceof ODataInlineEntity) {
- final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
- if (inline.getEditLink() != null) {
- toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
- }
- }
-
- if (link instanceof ODataInlineEntitySet) {
- final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
- for (CommonODataEntity entity : inline.getEntities()) {
- if (entity.getEditLink() != null) {
- toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
- }
- }
- }
- }
- }
-
- assertFalse(toBeDeleted.isEmpty());
-
- for (URI link : toBeDeleted) {
- final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(link);
- final ODataDeleteResponse deleteRes = deleteReq.execute();
-
- assertEquals(204, deleteRes.getStatusCode());
- assertEquals("No Content", deleteRes.getStatusMessage());
-
- deleteRes.close();
-
- final ODataEntityRequest<CommonODataEntity> retrieveReq = getClient().getRetrieveRequestFactory().
- getEntityRequest(link);
- // bug that needs to be fixed on the SampleService - cannot get entity not found with header
- // Accept: application/json;odata=minimalmetadata
- retrieveReq.setFormat(format == ODataPubFormat.JSON_FULL_METADATA ? ODataPubFormat.JSON : format);
-
- Exception exception = null;
- try {
- retrieveReq.execute();
- fail();
- } catch (ODataClientErrorException e) {
- exception = e;
- assertEquals(404, e.getStatusLine().getStatusCode());
- }
- assertNotNull(exception);
- }
- }
-
- protected void updateEntityDescription(
- final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type) {
-
- updateEntityDescription(format, changes, type, null);
- }
-
- protected void updateEntityDescription(
- final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type, final String etag) {
-
- updateEntityStringProperty("Description", format, changes, type, etag);
- }
-
- protected void updateEntityStringProperty(final String propertyName,
- final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type, final String etag) {
-
- final URI editLink = changes.getEditLink();
-
- final String newm = "New " + propertyName + "(" + System.currentTimeMillis() + ")";
-
- CommonODataProperty propertyValue = changes.getProperty(propertyName);
-
- final String oldm;
- if (propertyValue == null) {
- oldm = null;
- } else {
- oldm = propertyValue.getValue().toString();
- changes.getProperties().remove(propertyValue);
- }
-
- assertNotEquals(newm, oldm);
-
- getClient().getBinder().add(changes,
- getClient().getObjectFactory().newPrimitiveProperty(propertyName,
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
-
- update(type, changes, format, etag);
-
- final CommonODataEntity actual = read(format, editLink);
-
- propertyValue = null;
-
- for (CommonODataProperty prop : actual.getProperties()) {
- if (prop.getName().equals(propertyName)) {
- propertyValue = prop;
- }
- }
-
- assertNotNull(propertyValue);
- assertEquals(newm, propertyValue.getValue().toString());
- }
-
- protected void update(
- final UpdateType type, final CommonODataEntity changes, final ODataPubFormat format, final String etag) {
- final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory().getEntityUpdateRequest(type, changes);
-
- if (getClient().getConfiguration().isUseXHTTPMethod()) {
- assertEquals(HttpMethod.POST, req.getMethod());
- } else {
- assertEquals(type.getMethod(), req.getMethod());
- }
- req.setFormat(format);
-
- if (StringUtils.isNotBlank(etag)) {
- req.setIfMatch(etag); // Product include ETag header into the response .....
- }
-
- final ODataEntityUpdateResponse res = req.execute();
- assertEquals(204, res.getStatusCode());
- }
-}
[35/51] [abbrv] git commit: [OLINGO-168] More TechProvider Refactoring
Posted by sk...@apache.org.
[OLINGO-168] More TechProvider Refactoring
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/6a3a4a1d
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/6a3a4a1d
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/6a3a4a1d
Branch: refs/heads/olingo-206-validator
Commit: 6a3a4a1d7227198575822eb30bb237701583b061
Parents: 59ef14f
Author: Christian Amend <ch...@apache.org>
Authored: Tue Apr 1 16:43:10 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Tue Apr 1 16:46:50 2014 +0200
----------------------------------------------------------------------
.../client/core/edm/EdmBindingTargetImpl.java | 39 +-
.../client/core/edm/EdmEntityContainerImpl.java | 9 +-
.../core/edm/EdmNavigationPropertyImpl.java | 33 +-
.../client/core/edm/EdmOperationImpl.java | 2 +-
.../client/core/edm/v3/EdmEntitySetProxy.java | 7 +
.../commons/api/edm/EdmBindingTarget.java | 7 +
.../commons/api/edm/EdmEntityContainer.java | 5 +
.../commons/api/edm/EdmNavigationProperty.java | 27 +-
.../api/edm/EdmNavigationPropertyBinding.java | 28 ++
.../api/edm/EdmReferentialConstraint.java | 28 ++
.../core/edm/AbstractEdmEntityContainer.java | 11 +-
.../edm/EdmNavigationPropertyBindingImpl.java | 43 +++
.../core/edm/EdmReferentialConstraintImpl.java | 42 ++
.../core/edm/provider/EdmBindingTargetImpl.java | 24 ++
.../edm/provider/EdmEntityContainerImpl.java | 5 +-
.../edm/provider/EdmNavigationPropertyImpl.java | 18 +
.../core/serializer/ODataXmlSerializerImpl.java | 6 +-
.../xml/MetadataDocumentXmlSerializer.java | 323 +++++++++++-----
.../serializer/xml/MetadataDocumentTest.java | 6 +-
.../core/testutil/EdmTechTestProvider.java | 4 +-
.../testutil/techprovider/ActionProvider.java | 64 ++--
.../techprovider/ComplexTypeProvider.java | 26 +-
.../techprovider/ContainerProvider.java | 2 +-
.../testutil/techprovider/EdmTechProvider.java | 12 +
.../techprovider/EntityTypeProvider.java | 153 ++++----
.../testutil/techprovider/EnumTypeProvider.java | 3 +
.../testutil/techprovider/FunctionProvider.java | 380 +++++++++++--------
.../testutil/techprovider/PropertyProvider.java | 302 ++++++++++++++-
.../testutil/techprovider/SchemaProvider.java | 23 +-
.../techprovider/TypeDefinitionProvider.java | 2 +-
.../core/uri/antlr/TestUriParserImpl.java | 4 +-
31 files changed, 1210 insertions(+), 428 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
index 6f1990e..452c880 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
@@ -1,23 +1,24 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * 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.edm;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -27,16 +28,19 @@ import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
+import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl;
public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
private final BindingTarget target;
+ private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container,
- final String name, final FullQualifiedName type, final BindingTarget target) {
+ final String name, final FullQualifiedName type, final BindingTarget target) {
super(edm, container, name, type);
this.target = target;
@@ -48,8 +52,9 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
final List<? extends NavigationPropertyBinding> navigationPropertyBindings = target.getNavigationPropertyBindings();
boolean found = false;
- for (final Iterator<? extends NavigationPropertyBinding> itor = navigationPropertyBindings.iterator();
- itor.hasNext() && !found;) {
+ for (final Iterator<? extends NavigationPropertyBinding> itor = navigationPropertyBindings.iterator(); itor
+ .hasNext()
+ && !found;) {
final NavigationPropertyBinding binding = itor.next();
if (binding.getPath().equals(path)) {
@@ -76,4 +81,18 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
return bindingTarget;
}
+ @Override
+ public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() {
+ if (navigationPropertyBindings == null) {
+ List<? extends NavigationPropertyBinding> providerBindings = target.getNavigationPropertyBindings();
+ navigationPropertyBindings = new ArrayList<EdmNavigationPropertyBinding>();
+ if (providerBindings != null) {
+ for (NavigationPropertyBinding binding : providerBindings) {
+ navigationPropertyBindings.add(new EdmNavigationPropertyBindingImpl(binding.getPath(), binding.getTarget()));
+ }
+ }
+ }
+ return navigationPropertyBindings;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
index 169aaf9..6a962e3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@ -49,12 +49,19 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
final EntityContainer xmlEntityContainer, final XMLMetadata xmlMetadata) {
- super(edm, entityContainerName);
+ super(edm, entityContainerName, getFullQualifiedName(xmlEntityContainer.getExtends()));
this.xmlEntityContainer = xmlEntityContainer;
this.xmlMetadata = xmlMetadata;
}
+ private static FullQualifiedName getFullQualifiedName(String parent) {
+ if (parent != null) {
+ return new FullQualifiedName(parent);
+ }
+ return null;
+ }
+
@Override
protected EdmSingleton createSingleton(final String singletonName) {
if (!(xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer)) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
index 19df620..953da5b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
@@ -1,36 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * 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.edm;
+import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
import org.apache.olingo.client.api.edm.xml.v4.ReferentialConstraint;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
+import org.apache.olingo.commons.core.edm.EdmReferentialConstraintImpl;
public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
private final NavigationProperty navigationProperty;
private final EdmTypeInfo edmTypeInfo;
+ private List<EdmReferentialConstraint> referentialConstraints;
public EdmNavigationPropertyImpl(final Edm edm, final NavigationProperty navigationProperty) {
super(edm, navigationProperty.getName());
@@ -71,4 +75,19 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
return null;
}
+ @Override
+ public List<EdmReferentialConstraint> getReferentialConstraints() {
+ if (referentialConstraints == null) {
+ final List<ReferentialConstraint> providerConstraints = navigationProperty.getReferentialConstraints();
+ referentialConstraints = new ArrayList<EdmReferentialConstraint>();
+ if (providerConstraints != null) {
+ for (ReferentialConstraint constraint : providerConstraints) {
+ referentialConstraints.add(new EdmReferentialConstraintImpl(constraint.getProperty(), constraint
+ .getReferencedProperty()));
+ }
+ }
+ }
+ return referentialConstraints;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
index f54d6c1..a38602a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
@@ -85,6 +85,6 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
if (bindingParam != null) {
result = bindingParam.isCollection();
}
- return null;
+ return result;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
index 0cc0ff8..2624860 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
@@ -33,6 +33,7 @@ import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
@@ -105,4 +106,10 @@ public class EdmEntitySetProxy extends AbstractEdmBindingTarget implements EdmEn
return true;
}
+ @Override
+ public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() {
+ //There are no navigation property bindings in V3 so we will deliver an empty list
+ return new ArrayList<EdmNavigationPropertyBinding>();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java
index 87c9d34..1c66b80 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java
@@ -18,6 +18,8 @@
*/
package org.apache.olingo.commons.api.edm;
+import java.util.List;
+
/**
* Entity Sets or Singletons can be bound to each other using a navigation property binding so an
* {@link EdmBindingTarget} can either be an {@link EdmEntitySet} or an {@link EdmSingleton}.
@@ -33,6 +35,11 @@ public interface EdmBindingTarget extends EdmNamed {
EdmBindingTarget getRelatedBindingTarget(String path);
/**
+ * @return all navigation property bindings
+ */
+ List<EdmNavigationPropertyBinding> getNavigationPropertyBindings();
+
+ /**
* Returns the entity container this target is contained in.
*
* @return {@link EdmEntityContainer}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
index 00afbc8..84dfea4 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
@@ -89,4 +89,9 @@ public interface EdmEntityContainer extends EdmNamed {
*/
List<EdmActionImport> getActionImports();
+ /**
+ * @return the {@link FullQualifiedName} of the parentContainer or null if no parent is specified
+ */
+ FullQualifiedName getParentContainerName();
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
index 52c645f..5f54154 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
@@ -1,23 +1,25 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.commons.api.edm;
+import java.util.List;
+
/**
* A CSDL NavigationProperty element
* <br/>
@@ -35,6 +37,15 @@ public interface EdmNavigationProperty extends EdmElement {
*/
EdmNavigationProperty getPartner();
+ /**
+ * @param referencedPropertyName
+ * @return propertyName for this referenced property
+ */
String getReferencingPropertyName(String referencedPropertyName);
+ /**
+ * @return all referential constraints for this navigation property.
+ */
+ List<EdmReferentialConstraint> getReferentialConstraints();
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationPropertyBinding.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationPropertyBinding.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationPropertyBinding.java
new file mode 100644
index 0000000..2ebcf2b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationPropertyBinding.java
@@ -0,0 +1,28 @@
+/*
+ * 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.commons.api.edm;
+
+//TODO: JavaDoc
+public interface EdmNavigationPropertyBinding {
+
+ String getPath();
+
+ String getTarget();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java
new file mode 100644
index 0000000..e479efb
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java
@@ -0,0 +1,28 @@
+/*
+ * 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.commons.api.edm;
+
+//TODO: Document
+public interface EdmReferentialConstraint {
+
+ String getPropertyName();
+
+ String getReferencedPropertyName();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
index aba62ba..853d21f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
@@ -47,9 +47,13 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements
protected final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>();
private boolean allFunctionImportsLoaded = false;
- public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName) {
+ private final FullQualifiedName parentContainerName;
+
+ public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName,
+ final FullQualifiedName parentContainerName) {
super(edm, entityContainerName.getName());
this.entityContainerName = entityContainerName;
+ this.parentContainerName = parentContainerName;
}
@Override
@@ -148,4 +152,9 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements
}
protected abstract void loadAllActionImports();
+
+ @Override
+ public FullQualifiedName getParentContainerName() {
+ return parentContainerName;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java
new file mode 100644
index 0000000..233e5d2
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.commons.core.edm;
+
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
+
+public class EdmNavigationPropertyBindingImpl implements EdmNavigationPropertyBinding {
+
+ private final String path;
+ private final String target;
+
+ public EdmNavigationPropertyBindingImpl(String path, String target){
+ this.path = path;
+ this.target = target;
+ }
+
+ @Override
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public String getTarget() {
+ return target;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java
new file mode 100644
index 0000000..93e1519
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java
@@ -0,0 +1,42 @@
+/*
+ * 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.commons.core.edm;
+
+import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
+
+public class EdmReferentialConstraintImpl implements EdmReferentialConstraint {
+
+ private final String property;
+ private final String referencedProperty;
+
+ public EdmReferentialConstraintImpl(String property, String referencedProperty) {
+ this.property = property;
+ this.referencedProperty = referencedProperty;
+ }
+
+ @Override
+ public String getPropertyName() {
+ return property;
+ }
+
+ @Override
+ public String getReferencedPropertyName() {
+ return referencedProperty;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
index c1aacb1..78651bc 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.server.core.edm.provider;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -25,14 +26,17 @@ import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
+import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl;
import org.apache.olingo.server.api.edm.provider.BindingTarget;
import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding;
public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
private final BindingTarget target;
+ private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container, final BindingTarget target) {
super(edm, container, target.getName(), target.getType());
@@ -74,4 +78,24 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
return bindingTarget;
}
+
+ @Override
+ public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() {
+ if (navigationPropertyBindings == null) {
+ List<NavigationPropertyBinding> providerBindings = target.getNavigationPropertyBindings();
+ navigationPropertyBindings = new ArrayList<EdmNavigationPropertyBinding>();
+ if (providerBindings != null) {
+ for (NavigationPropertyBinding binding : providerBindings) {
+ Target providerTarget = binding.getTarget();
+ String targetString = "";
+ if (providerTarget.getEntityContainer() != null) {
+ targetString = targetString + providerTarget.getEntityContainer().getFullQualifiedNameAsString() + "/";
+ }
+ targetString = targetString + providerTarget.getTargetName();
+ navigationPropertyBindings.add(new EdmNavigationPropertyBindingImpl(binding.getPath(), targetString));
+ }
+ }
+ }
+ return navigationPropertyBindings;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
index 7c81980..1a1012a 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
@@ -44,14 +44,13 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
final EntityContainerInfo entityContainerInfo) {
-
- super(edm, entityContainerInfo.getContainerName());
+ super(edm, entityContainerInfo.getContainerName(), entityContainerInfo.getExtendsContainer());
this.provider = provider;
}
public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN,
final EntityContainer entityContainer) {
- super(edm, containerFQN);
+ super(edm, containerFQN, entityContainer.getExtendsContainer());
this.provider = provider;
container = entityContainer;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
index 7f570da..4c7e0cb 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
@@ -18,17 +18,21 @@
*/
package org.apache.olingo.server.core.edm.provider;
+import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
+import org.apache.olingo.commons.core.edm.EdmReferentialConstraintImpl;
import org.apache.olingo.server.api.edm.provider.NavigationProperty;
import org.apache.olingo.server.api.edm.provider.ReferentialConstraint;
public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
private final NavigationProperty navigationProperty;
+ private List<EdmReferentialConstraint> referentialConstraints;
public EdmNavigationPropertyImpl(final Edm edm, final NavigationProperty navigationProperty) {
super(edm, navigationProperty.getName());
@@ -68,4 +72,18 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
return null;
}
+ @Override
+ public List<EdmReferentialConstraint> getReferentialConstraints() {
+ if (referentialConstraints == null) {
+ final List<ReferentialConstraint> providerConstraints = navigationProperty.getReferentialConstraints();
+ referentialConstraints = new ArrayList<EdmReferentialConstraint>();
+ if (providerConstraints != null) {
+ for (ReferentialConstraint constraint : providerConstraints) {
+ referentialConstraints.add(new EdmReferentialConstraintImpl(constraint.getProperty(), constraint
+ .getReferencedProperty()));
+ }
+ }
+ }
+ return referentialConstraints;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java
index 4790446..49f8831 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java
@@ -18,9 +18,7 @@
*/
package org.apache.olingo.server.core.serializer;
-import java.io.BufferedWriter;
import java.io.InputStream;
-import java.io.OutputStreamWriter;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
@@ -46,14 +44,12 @@ public class ODataXmlSerializerImpl implements ODataSerializer {
@Override
public InputStream metadataDocument(final Edm edm) {
CircleStreamBuffer buffer;
- BufferedWriter writer;
XMLStreamWriter xmlStreamWriter = null;
// TODO: move stream initialization into separate method
try {
buffer = new CircleStreamBuffer();
- writer = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET));
- xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer);
+ xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET);
MetadataDocumentXmlSerializer serializer = new MetadataDocumentXmlSerializer(edm);
serializer.writeMetadataDocument(xmlStreamWriter);
xmlStreamWriter.close();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
index b7f6015..2313a3a 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
@@ -26,6 +26,7 @@ import javax.xml.stream.XMLStreamWriter;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
@@ -35,16 +36,64 @@ import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
+import org.apache.olingo.commons.api.edm.EdmOperation;
import org.apache.olingo.commons.api.edm.EdmParameter;
import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmSingleton;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
public class MetadataDocumentXmlSerializer {
+ private static final String XML_EXTENDS = "Extends";
+ private static final String XML_TARGET = "Target";
+ private static final String XML_PATH = "Path";
+ private static final String XML_NAVIGATION_PROPERTY_BINDING = "NavigationPropertyBinding";
+ private static final String XML_VALUE = "Value";
+ private static final String XML_MEMBER = "Member";
+ private static final String XML_UNDERLYING_TYPE = "UnderlyingType";
+ private static final String XML_IS_FLAGS = "IsFlags";
+ private static final String XML_ENUM_TYPE = "EnumType";
+ private static final String XML_PROPERTY_REF = "PropertyRef";
+ private static final String XML_KEY = "Key";
+ private static final String XML_SCALE = "Scale";
+ private static final String XML_PRECISION = "Precision";
+ private static final String XML_MAX_LENGTH = "MaxLength";
+ private static final String XML_DEFAULT_VALUE = "DefaultValue";
+ private static final String XML_UNICODE = "Unicode";
+ private static final String XML_PROPERTY = "Property";
+ private static final String XML_PARTNER = "Partner";
+ private static final String XML_NULLABLE = "Nullable";
+ private static final String XML_NAVIGATION_PROPERTY = "NavigationProperty";
+ private static final String XML_HAS_STREAM = "HasStream";
+ private static final String XML_BASE_TYPE = "BaseType";
+ private static final String XML_COMPLEX_TYPE = "ComplexType";
+ private static final String XML_RETURN_TYPE = "ReturnType";
+ private static final String XML_TYPE = "Type";
+ private static final String XML_PARAMETER = "Parameter";
+ private static final String XML_IS_COMPOSABLE = "IsComposable";
+ private static final String XML_IS_BOUND = "IsBound";
+ private static final String XML_ENTITY_TYPE = "EntityType";
+ private static final String XML_SINGLETON = "Singleton";
+ private static final String XML_ACTION = "Action";
+ private static final String XML_ACTION_IMPORT = "ActionImport";
+ private static final String XML_INCLUDE_IN_SERVICE_DOCUMENT = "IncludeInServiceDocument";
+ private static final String XML_ENTITY_SET = "EntitySet";
+ private static final String XML_FUNCTION = "Function";
+ private static final String XML_FUNCTION_IMPORT = "FunctionImport";
+ private static final String XML_NAME = "Name";
+ private static final String XML_ENTITY_CONTAINER = "EntityContainer";
+ private static final String XML_ALIAS = "Alias";
+ private static final String XML_NAMESPACE = "Namespace";
+ private static final String XML_TYPE_DEFINITION = "TypeDefinition";
+
private final Edm edm;
private final static String EDMX = "Edmx";
@@ -58,7 +107,7 @@ public class MetadataDocumentXmlSerializer {
}
public void writeMetadataDocument(final XMLStreamWriter writer) throws XMLStreamException {
- writer.writeStartDocument();
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
writer.setPrefix(PREFIX_EDMX, NS_EDMX);
writer.setDefaultNamespace(NS_EDMX);
writer.writeStartElement(PREFIX_EDMX, EDMX, NS_EDMX);
@@ -74,7 +123,6 @@ public class MetadataDocumentXmlSerializer {
private void appendDataServices(final XMLStreamWriter writer) throws XMLStreamException {
writer.setDefaultNamespace(NS_EDM);
-// writer.writeStartElement(PREFIX_EDM, "DataServices", NS_EDMX);
writer.writeStartElement(NS_EDMX, "DataServices");
for (EdmSchema schema : edm.getSchemas()) {
appendSchema(writer, schema);
@@ -85,8 +133,8 @@ public class MetadataDocumentXmlSerializer {
private void appendSchema(final XMLStreamWriter writer, final EdmSchema schema) throws XMLStreamException {
writer.writeStartElement(NS_EDM, "Schema");
writer.writeDefaultNamespace(NS_EDM);
- writer.writeAttribute("Namespace", schema.getNamespace());
- writer.writeAttribute("Alias", schema.getAlias());
+ writer.writeAttribute(XML_NAMESPACE, schema.getNamespace());
+ writer.writeAttribute(XML_ALIAS, schema.getAlias());
// EnumTypes
appendEnumTypes(writer, schema.getEnumTypes());
@@ -98,7 +146,7 @@ public class MetadataDocumentXmlSerializer {
appendComplexTypes(writer, schema.getComplexTypes());
// TypeDefinitions
- // TODO: TypeDefinitions
+ appendTypeDefinitions(writer, schema.getTypeDefinitions());
// Actions
appendActions(writer, schema.getActions());
@@ -112,13 +160,38 @@ public class MetadataDocumentXmlSerializer {
writer.writeEndElement();
}
+ private void appendTypeDefinitions(XMLStreamWriter writer, List<EdmTypeDefinition> typeDefinitions)
+ throws XMLStreamException {
+ for (EdmTypeDefinition definition : typeDefinitions) {
+ writer.writeEmptyElement(XML_TYPE_DEFINITION);
+ writer.writeAttribute(XML_NAME, definition.getName());
+ writer.writeAttribute(XML_TYPE, getFullQualifiedName(definition.getUnderlyingType(), false));
+
+ // Facets
+ if (definition.getMaxLength() != null) {
+ writer.writeAttribute(XML_MAX_LENGTH, "" + definition.getMaxLength());
+ }
+
+ if (definition.getPrecision() != null) {
+ writer.writeAttribute(XML_PRECISION, "" + definition.getPrecision());
+ }
+
+ if (definition.getScale() != null) {
+ writer.writeAttribute(XML_SCALE, "" + definition.getScale());
+ }
+ }
+ }
+
private void appendEntityContainer(final XMLStreamWriter writer, final EdmEntityContainer container)
throws XMLStreamException {
if (container != null) {
- writer.writeStartElement("EntityContainer");
+ writer.writeStartElement(XML_ENTITY_CONTAINER);
- writer.writeAttribute("Name", container.getName());
- // TODO: extends attribute
+ writer.writeAttribute(XML_NAME, container.getName());
+ FullQualifiedName parentContainerName = container.getParentContainerName();
+ if (parentContainerName != null) {
+ writer.writeAttribute(XML_EXTENDS, parentContainerName.getFullQualifiedNameAsString());
+ }
// EntitySets
appendEntitySets(writer, container.getEntitySets());
@@ -139,14 +212,14 @@ public class MetadataDocumentXmlSerializer {
private void appendFunctionImports(final XMLStreamWriter writer, final List<EdmFunctionImport> functionImports,
final String containerNamespace) throws XMLStreamException {
for (EdmFunctionImport functionImport : functionImports) {
- writer.writeStartElement("FunctionImport");
- writer.writeAttribute("Name", functionImport.getName());
- writer.writeAttribute("Function", functionImport.getFunctionFqn().getFullQualifiedNameAsString());
+ writer.writeStartElement(XML_FUNCTION_IMPORT);
+ writer.writeAttribute(XML_NAME, functionImport.getName());
+ writer.writeAttribute(XML_FUNCTION, functionImport.getFunctionFqn().getFullQualifiedNameAsString());
EdmEntitySet returnedEntitySet = functionImport.getReturnedEntitySet();
if (returnedEntitySet != null) {
- writer.writeAttribute("EntitySet", containerNamespace + "." + returnedEntitySet.getName());
+ writer.writeAttribute(XML_ENTITY_SET, containerNamespace + "." + returnedEntitySet.getName());
}
- writer.writeAttribute("IncludeInServiceDocument", "" + functionImport.isIncludeInServiceDocument());
+ writer.writeAttribute(XML_INCLUDE_IN_SERVICE_DOCUMENT, "" + functionImport.isIncludeInServiceDocument());
// TODO: Annotations
writer.writeEndElement();
@@ -156,9 +229,9 @@ public class MetadataDocumentXmlSerializer {
private void appendActionImports(final XMLStreamWriter writer, final List<EdmActionImport> actionImports)
throws XMLStreamException {
for (EdmActionImport actionImport : actionImports) {
- writer.writeStartElement("ActionImport");
- writer.writeAttribute("Name", actionImport.getName());
- writer.writeAttribute("Action", getFullQualifiedName(actionImport.getAction(), false));
+ writer.writeStartElement(XML_ACTION_IMPORT);
+ writer.writeAttribute(XML_NAME, actionImport.getName());
+ writer.writeAttribute(XML_ACTION, getFullQualifiedName(actionImport.getAction(), false));
// TODO: Annotations
writer.writeEndElement();
}
@@ -166,29 +239,37 @@ public class MetadataDocumentXmlSerializer {
private void appendSingletons(final XMLStreamWriter writer, final List<EdmSingleton> singletons)
throws XMLStreamException {
- // TODO: Merge with entity set method
for (EdmSingleton singleton : singletons) {
- writer.writeStartElement("Singleton");
- writer.writeAttribute("Name", singleton.getName());
- writer.writeAttribute("EntityType", getFullQualifiedName(singleton.getEntityType(), false));
-
- // TODO: NavigationProperty Bindigs at edm api level
+ writer.writeStartElement(XML_SINGLETON);
+ writer.writeAttribute(XML_NAME, singleton.getName());
+ writer.writeAttribute(XML_ENTITY_TYPE, getFullQualifiedName(singleton.getEntityType(), false));
+ appendNavigationPropertyBindings(writer, singleton);
// TODO: Annotations
writer.writeEndElement();
}
}
+ private void appendNavigationPropertyBindings(final XMLStreamWriter writer, EdmBindingTarget bindingTarget)
+ throws XMLStreamException {
+ if (bindingTarget.getNavigationPropertyBindings() != null) {
+ for (EdmNavigationPropertyBinding binding : bindingTarget.getNavigationPropertyBindings()) {
+ writer.writeEmptyElement(XML_NAVIGATION_PROPERTY_BINDING);
+ writer.writeAttribute(XML_PATH, binding.getPath());
+ writer.writeAttribute(XML_TARGET, binding.getTarget());
+ }
+ }
+ }
+
private void appendEntitySets(final XMLStreamWriter writer, final List<EdmEntitySet> entitySets)
throws XMLStreamException {
for (EdmEntitySet entitySet : entitySets) {
- writer.writeStartElement("EntitySet");
- writer.writeAttribute("Name", entitySet.getName());
- writer.writeAttribute("EntityType", getFullQualifiedName(entitySet.getEntityType(), false));
-
- // TODO: NavigationProperty Bindigs at edm api level
+ writer.writeStartElement(XML_ENTITY_SET);
+ writer.writeAttribute(XML_NAME, entitySet.getName());
+ writer.writeAttribute(XML_ENTITY_TYPE, getFullQualifiedName(entitySet.getEntityType(), false));
+ appendNavigationPropertyBindings(writer, entitySet);
// TODO: Annotations
writer.writeEndElement();
}
@@ -197,64 +278,95 @@ public class MetadataDocumentXmlSerializer {
private void appendFunctions(final XMLStreamWriter writer, final List<EdmFunction> functions)
throws XMLStreamException {
for (EdmFunction function : functions) {
- writer.writeStartElement("Function");
- writer.writeAttribute("Name", function.getName());
- writer.writeAttribute("IsBound", "" + function.isBound());
- writer.writeAttribute("IsComposable", "" + function.isComposable());
-
- // TODO: move to separate method like for actions
- for (String parameterName : function.getParameterNames()) {
- EdmParameter parameter = function.getParameter(parameterName);
- writer.writeEmptyElement("Parameter");
- writer.writeAttribute("Name", parameterName);
- writer.writeAttribute("Type", getFullQualifiedName(parameter.getType(), parameter.isCollection()));
- // TODO: Parameter facets
- }
+ writer.writeStartElement(XML_FUNCTION);
+ writer.writeAttribute(XML_NAME, function.getName());
+ // TODO: EntitySetPath
+ writer.writeAttribute(XML_IS_BOUND, "" + function.isBound());
+ writer.writeAttribute(XML_IS_COMPOSABLE, "" + function.isComposable());
- EdmReturnType returnType = function.getReturnType();
- if (returnType != null) {
- writer.writeEmptyElement("ReturnType");
- writer.writeAttribute("Type", getFullQualifiedName(returnType.getType(), returnType.isCollection()));
- // TODO: Return type facets
- }
+ appendOperationParameters(writer, function);
+
+ appendOperationReturnType(writer, function);
writer.writeEndElement();
}
}
+ private void appendOperationReturnType(final XMLStreamWriter writer, EdmOperation operation)
+ throws XMLStreamException {
+ EdmReturnType returnType = operation.getReturnType();
+ if (returnType != null) {
+ writer.writeEmptyElement(XML_RETURN_TYPE);
+ writer.writeAttribute(XML_TYPE, getFullQualifiedName(returnType.getType(), returnType.isCollection()));
+
+ appendReturnTypeFacets(writer, returnType);
+ }
+ }
+
+ private void appendOperationParameters(final XMLStreamWriter writer, EdmOperation operation)
+ throws XMLStreamException {
+ for (String parameterName : operation.getParameterNames()) {
+ EdmParameter parameter = operation.getParameter(parameterName);
+ writer.writeEmptyElement(XML_PARAMETER);
+ writer.writeAttribute(XML_NAME, parameterName);
+ writer.writeAttribute(XML_TYPE, getFullQualifiedName(parameter.getType(), parameter.isCollection()));
+
+ appendParameterFacets(writer, parameter);
+ }
+ }
+
private void appendActions(final XMLStreamWriter writer, final List<EdmAction> actions) throws XMLStreamException {
for (EdmAction action : actions) {
- writer.writeStartElement("Action");
- writer.writeAttribute("Name", action.getName());
- writer.writeAttribute("IsBound", "" + action.isBound());
-
- for (String parameterName : action.getParameterNames()) {
- EdmParameter parameter = action.getParameter(parameterName);
- writer.writeEmptyElement("Parameter");
- writer.writeAttribute("Name", parameterName);
- writer.writeAttribute("Type", getFullQualifiedName(parameter.getType(), parameter.isCollection()));
- // TODO: Parameter facets
- }
+ writer.writeStartElement(XML_ACTION);
+ writer.writeAttribute(XML_NAME, action.getName());
+ writer.writeAttribute(XML_IS_BOUND, "" + action.isBound());
- EdmReturnType returnType = action.getReturnType();
- if (returnType != null) {
- writer.writeEmptyElement("ReturnType");
- writer.writeAttribute("Type", getFullQualifiedName(returnType.getType(), returnType.isCollection()));
- // TODO: Return type facets
- }
+ appendOperationParameters(writer, action);
+
+ appendOperationReturnType(writer, action);
writer.writeEndElement();
}
}
+ private void appendReturnTypeFacets(XMLStreamWriter writer, EdmReturnType returnType) throws XMLStreamException {
+ if (returnType.isNullable() != null) {
+ writer.writeAttribute(XML_NULLABLE, "" + returnType.isNullable());
+ }
+ if (returnType.getMaxLength() != null) {
+ writer.writeAttribute(XML_MAX_LENGTH, "" + returnType.getMaxLength());
+ }
+ if (returnType.getPrecision() != null) {
+ writer.writeAttribute(XML_PRECISION, "" + returnType.getPrecision());
+ }
+ if (returnType.getScale() != null) {
+ writer.writeAttribute(XML_SCALE, "" + returnType.getScale());
+ }
+ }
+
+ private void appendParameterFacets(XMLStreamWriter writer, EdmParameter parameter) throws XMLStreamException {
+ if (parameter.isNullable() != null) {
+ writer.writeAttribute(XML_NULLABLE, "" + parameter.isNullable());
+ }
+ if (parameter.getMaxLength() != null) {
+ writer.writeAttribute(XML_MAX_LENGTH, "" + parameter.getMaxLength());
+ }
+ if (parameter.getPrecision() != null) {
+ writer.writeAttribute(XML_PRECISION, "" + parameter.getPrecision());
+ }
+ if (parameter.getScale() != null) {
+ writer.writeAttribute(XML_SCALE, "" + parameter.getScale());
+ }
+ }
+
private void appendComplexTypes(final XMLStreamWriter writer, final List<EdmComplexType> complexTypes)
throws XMLStreamException {
for (EdmComplexType complexType : complexTypes) {
- writer.writeStartElement("ComplexType");
- writer.writeAttribute("Name", complexType.getName());
+ writer.writeStartElement(XML_COMPLEX_TYPE);
+ writer.writeAttribute(XML_NAME, complexType.getName());
if (complexType.getBaseType() != null) {
- writer.writeAttribute("BaseType", getFullQualifiedName(complexType.getBaseType(), false));
+ writer.writeAttribute(XML_BASE_TYPE, getFullQualifiedName(complexType.getBaseType(), false));
}
appendProperties(writer, complexType);
@@ -268,15 +380,15 @@ public class MetadataDocumentXmlSerializer {
private void appendEntityTypes(final XMLStreamWriter writer, final List<EdmEntityType> entityTypes)
throws XMLStreamException {
for (EdmEntityType entityType : entityTypes) {
- writer.writeStartElement("EntityType");
- writer.writeAttribute("Name", entityType.getName());
+ writer.writeStartElement(XML_ENTITY_TYPE);
+ writer.writeAttribute(XML_NAME, entityType.getName());
if (entityType.hasStream()) {
- writer.writeAttribute("HasStream", "" + entityType.hasStream());
+ writer.writeAttribute(XML_HAS_STREAM, "" + entityType.hasStream());
}
if (entityType.getBaseType() != null) {
- writer.writeAttribute("BaseType", getFullQualifiedName(entityType.getBaseType(), false));
+ writer.writeAttribute(XML_BASE_TYPE, getFullQualifiedName(entityType.getBaseType(), false));
}
appendKey(writer, entityType);
@@ -298,18 +410,28 @@ public class MetadataDocumentXmlSerializer {
for (String navigationPropertyName : navigationPropertyNames) {
EdmNavigationProperty navigationProperty = type.getNavigationProperty(navigationPropertyName);
- writer.writeEmptyElement("NavigationProperty");
- writer.writeAttribute("Name", navigationPropertyName);
- writer.writeAttribute("Type", getFullQualifiedName(navigationProperty.getType(), navigationProperty
+ writer.writeStartElement(XML_NAVIGATION_PROPERTY);
+ writer.writeAttribute(XML_NAME, navigationPropertyName);
+ writer.writeAttribute(XML_TYPE, getFullQualifiedName(navigationProperty.getType(), navigationProperty
.isCollection()));
if (navigationProperty.isNullable() != null) {
- writer.writeAttribute("Nullable", "" + navigationProperty.isNullable());
+ writer.writeAttribute(XML_NULLABLE, "" + navigationProperty.isNullable());
}
if (navigationProperty.getPartner() != null) {
EdmNavigationProperty partner = navigationProperty.getPartner();
- writer.writeAttribute("Partner", partner.getName());
+ writer.writeAttribute(XML_PARTNER, partner.getName());
+ }
+
+ if (navigationProperty.getReferentialConstraints() != null) {
+ for (EdmReferentialConstraint constraint : navigationProperty.getReferentialConstraints()) {
+ writer.writeEmptyElement("ReferentialConstraint");
+ writer.writeAttribute(XML_PROPERTY, constraint.getPropertyName());
+ writer.writeAttribute("ReferencedProperty", constraint.getReferencedPropertyName());
+ }
}
+
+ writer.writeEndElement();
}
}
@@ -320,33 +442,33 @@ public class MetadataDocumentXmlSerializer {
}
for (String propertyName : propertyNames) {
EdmProperty property = type.getStructuralProperty(propertyName);
- writer.writeEmptyElement("Property");
- writer.writeAttribute("Name", propertyName);
- writer.writeAttribute("Type", getFullQualifiedName(property.getType(), property.isCollection()));
+ writer.writeEmptyElement(XML_PROPERTY);
+ writer.writeAttribute(XML_NAME, propertyName);
+ writer.writeAttribute(XML_TYPE, getFullQualifiedName(property.getType(), property.isCollection()));
// Facets
if (property.isNullable() != null) {
- writer.writeAttribute("Nullable", "" + property.isNullable());
+ writer.writeAttribute(XML_NULLABLE, "" + property.isNullable());
}
if (property.isUnicode() != null) {
- writer.writeAttribute("Unicode", "" + property.isUnicode());
+ writer.writeAttribute(XML_UNICODE, "" + property.isUnicode());
}
if (property.getDefaultValue() != null) {
- writer.writeAttribute("DefaultValue", property.getDefaultValue());
+ writer.writeAttribute(XML_DEFAULT_VALUE, property.getDefaultValue());
}
if (property.getMaxLength() != null) {
- writer.writeAttribute("MaxLength", "" + property.getMaxLength());
+ writer.writeAttribute(XML_MAX_LENGTH, "" + property.getMaxLength());
}
if (property.getPrecision() != null) {
- writer.writeAttribute("Precision", "" + property.getPrecision());
+ writer.writeAttribute(XML_PRECISION, "" + property.getPrecision());
}
if (property.getScale() != null) {
- writer.writeAttribute("Scale", "" + property.getScale());
+ writer.writeAttribute(XML_SCALE, "" + property.getScale());
}
}
}
@@ -354,19 +476,25 @@ public class MetadataDocumentXmlSerializer {
private void appendKey(final XMLStreamWriter writer, final EdmEntityType entityType) throws XMLStreamException {
List<EdmKeyPropertyRef> keyPropertyRefs = entityType.getKeyPropertyRefs();
if (keyPropertyRefs != null && !keyPropertyRefs.isEmpty()) {
- writer.writeStartElement("Key");
+ // Resolve Base Type key as it is shown in derived type
+ EdmEntityType baseType = entityType.getBaseType();
+ if (baseType != null && baseType.getKeyPropertyRefs() != null && !(baseType.getKeyPropertyRefs().isEmpty())) {
+ return;
+ }
+
+ writer.writeStartElement(XML_KEY);
for (EdmKeyPropertyRef keyRef : keyPropertyRefs) {
- writer.writeEmptyElement("PropertyRef");
+ writer.writeEmptyElement(XML_PROPERTY_REF);
String keyName = null;
if (keyRef.getPath() != null) {
keyName = keyRef.getPath() + "/" + keyRef.getKeyPropertyName();
} else {
keyName = keyRef.getKeyPropertyName();
}
- writer.writeAttribute("Name", keyName);
+ writer.writeAttribute(XML_NAME, keyName);
if (keyRef.getAlias() != null) {
- writer.writeAttribute("Alias", keyRef.getAlias());
+ writer.writeAttribute(XML_ALIAS, keyRef.getAlias());
}
}
writer.writeEndElement();
@@ -376,15 +504,15 @@ public class MetadataDocumentXmlSerializer {
private void appendEnumTypes(final XMLStreamWriter writer, final List<EdmEnumType> enumTypes)
throws XMLStreamException {
for (EdmEnumType enumType : enumTypes) {
- writer.writeStartElement("EnumType");
- writer.writeAttribute("Name", enumType.getName());
- writer.writeAttribute("isFlags", "" + enumType.isFlags());
- writer.writeAttribute("UnderlyingType", getFullQualifiedName(enumType.getUnderlyingType(), false));
+ writer.writeStartElement(XML_ENUM_TYPE);
+ writer.writeAttribute(XML_NAME, enumType.getName());
+ writer.writeAttribute(XML_IS_FLAGS, "" + enumType.isFlags());
+ writer.writeAttribute(XML_UNDERLYING_TYPE, getFullQualifiedName(enumType.getUnderlyingType(), false));
for (String memberName : enumType.getMemberNames()) {
- writer.writeEmptyElement("Member");
- writer.writeAttribute("Name", memberName);
- writer.writeAttribute("Value", enumType.getMember(memberName).getValue());
+ writer.writeEmptyElement(XML_MEMBER);
+ writer.writeAttribute(XML_NAME, memberName);
+ writer.writeAttribute(XML_VALUE, enumType.getMember(memberName).getValue());
}
writer.writeEndElement();
@@ -405,10 +533,9 @@ public class MetadataDocumentXmlSerializer {
writer.writeAttribute("Uri", "http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml");
writer.writeEmptyElement(NS_EDMX, "Include");
// TODO: Where is this value comming from?
- writer.writeAttribute("Namespace", "Org.OData.Core.V1");
+ writer.writeAttribute(XML_NAMESPACE, "Org.OData.Core.V1");
// TODO: Where is this value comming from?
- writer.writeAttribute("Alias", "Core");
+ writer.writeAttribute(XML_ALIAS, "Core");
writer.writeEndElement();
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
index 40868df..88f84ec 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
@@ -41,7 +41,7 @@ public class MetadataDocumentTest {
}
@Test
- public void writeMetadataWithMockedEdm() {
+ public void writeMetadataWithEmptyMockedEdm() {
ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML);
Edm edm = mock(Edm.class);
serializer.metadataDocument(edm);
@@ -52,7 +52,7 @@ public class MetadataDocumentTest {
ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML);
EdmProviderImpl edm = new EdmProviderImpl(new EdmTechProvider());
InputStream metadata = serializer.metadataDocument(edm);
- System.out.println(StringUtils.inputStreamToString(metadata, true));
+ String metadataString = StringUtils.inputStreamToString(metadata, false);
+ //System.out.println(metadataString);
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
index f3cc85c..8e6fc1f 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
@@ -42,7 +42,7 @@ public class EdmTechTestProvider extends EdmTechProvider {
private static final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
public static final String nameSpace = "com.sap.odata.test1";
public static final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "Container");
-
+
Property propertyAInt16 = new Property().setName("a").setType(nameInt16);
Property propertyBInt16 = new Property().setName("b").setType(nameInt16);
Property propertyCInt16 = new Property().setName("c").setType(nameInt16);
@@ -70,7 +70,7 @@ public class EdmTechTestProvider extends EdmTechProvider {
@Override
public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
- if (entityContainer == nameContainer) {
+ if (nameContainer.equals(entityContainer)) {
if (name.equals("ESabc")) {
return new EntitySet()
.setName("ESabc")
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
index 3ddc6d9..ef3cb19 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
@@ -29,7 +29,7 @@ import org.apache.olingo.server.api.edm.provider.ReturnType;
public class ActionProvider {
- //Bound Actions
+ // Bound Actions
public static final FullQualifiedName nameBAESAllPrimRTETAllPrim =
new FullQualifiedName(SchemaProvider.nameSpace, "BAESAllPrimRTETAllPrim");
@@ -45,18 +45,22 @@ public class ActionProvider {
public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav =
new FullQualifiedName(SchemaProvider.nameSpace, "BAETTwoKeyNavRTETTwoKeyNav");
+ // Unbound Actions
+ public static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UARTCompCollParam");
+ public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UARTCompParam");
+ public static final FullQualifiedName nameUARTESParam =
+ new FullQualifiedName(SchemaProvider.nameSpace, "UARTESParam");
+
+ public static final FullQualifiedName nameUARTETParam =
+ new FullQualifiedName(SchemaProvider.nameSpace, "UARTETParam");
- //Unbound Actions
- public static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTCompCollParam");
- public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTCompParam");
- public static final FullQualifiedName nameUARTETCollAllPrimParam =
- new FullQualifiedName(SchemaProvider.nameSpace, "UARTETCollAllPrimParam");
-
- public static final FullQualifiedName nameUARTETParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTETParam");
- public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTPrimParam");
- public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTPrimCollParam");
-
-
+ public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UARTPrimParam");
+ public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UARTPrimCollParam");
+
public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
if (actionName.equals(nameUARTPrimParam)) {
return Arrays.asList(
@@ -99,35 +103,36 @@ public class ActionProvider {
} else if (actionName.equals(nameUARTETParam)) {
return Arrays.asList(
- new Action().setName("UARTCompCollParam")
+ new Action().setName("UARTETParam")
.setParameters(Arrays.asList(
new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim))
);
- } else if (actionName.equals(nameUARTETCollAllPrimParam)) {
+ } else if (actionName.equals(nameUARTESParam)) {
return Arrays.asList(
- new Action().setName("UARTETCollAllPrimParam")
+ new Action().setName("UARTESParam")
.setParameters(Arrays.asList(
new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
-
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETCollAllPrim).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))
);
} else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
return Arrays.asList(
new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)))
+ new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
,
new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav)))
+ new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav)
+ .setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
@@ -136,8 +141,10 @@ public class ActionProvider {
} else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) {
return Arrays.asList(
new Action().setName("BAESAllPrimRTETAllPrim")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim).setCollection(true)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim)
+ .setCollection(true).setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETAllPrim))
@@ -146,8 +153,10 @@ public class ActionProvider {
} else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) {
return Arrays.asList(
new Action().setName("BAESTwoKeyNavRTESTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setCollection(true).setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
@@ -157,7 +166,8 @@ public class ActionProvider {
return Arrays.asList(
new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav)))
+ new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
@@ -166,8 +176,10 @@ public class ActionProvider {
} else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) {
return Arrays.asList(
new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType(
+ EntityTypeProvider.nameETTwoBaseTwoKeyNav).setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav))
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
index 3eaf86f..2fcbec2 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
@@ -30,14 +30,19 @@ public class ComplexTypeProvider {
public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "CTAllPrim");
public static final FullQualifiedName nameCTBase = new FullQualifiedName(SchemaProvider.nameSpace, "CTBase");
- public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(SchemaProvider.nameSpace, "CTBasePrimCompNav");
- public static final FullQualifiedName nameCTCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "CTCollAllPrim");
- public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "CTCompCollComp");
+ public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(SchemaProvider.nameSpace,
+ "CTBasePrimCompNav");
+ public static final FullQualifiedName nameCTCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace,
+ "CTCollAllPrim");
+ public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(SchemaProvider.nameSpace,
+ "CTCompCollComp");
public static final FullQualifiedName nameCTCompComp = new FullQualifiedName(SchemaProvider.nameSpace, "CTCompComp");
public static final FullQualifiedName nameCTCompNav = new FullQualifiedName(SchemaProvider.nameSpace, "CTCompNav");
- public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "CTMixPrimCollComp");
- public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(SchemaProvider.nameSpace, "CTNavFiveProp");
+ public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace,
+ "CTMixPrimCollComp");
+ public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(SchemaProvider.nameSpace,
+ "CTNavFiveProp");
public static final FullQualifiedName nameCTPrim = new FullQualifiedName(SchemaProvider.nameSpace, "CTPrim");
public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(SchemaProvider.nameSpace, "CTPrimComp");
public static final FullQualifiedName nameCTPrimEnum = new FullQualifiedName(SchemaProvider.nameSpace, "CTPrimEnum");
@@ -88,7 +93,8 @@ public class ComplexTypeProvider {
} else if (complexTypeName.equals(nameCTCompNav)) {
return new ComplexType()
.setName("CTCompNav")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyComplex_CTNavFiveProp));
+ .setProperties(Arrays.asList(PropertyProvider.propertyString,
+ PropertyProvider.propertyComplex_CTNavFiveProp));
} else if (complexTypeName.equals(nameCTMixPrimCollComp)) {
return new ComplexType()
@@ -112,7 +118,7 @@ public class ComplexTypeProvider {
.setBaseType(nameCTBase)
.setProperties(Arrays.asList(
new Property()
- .setName("AdditionalPropString")
+ .setName("AdditionalPropString2")
.setType(new FullQualifiedName("Edm", "String"))));
} else if (complexTypeName.equals(nameCTCompComp)) {
@@ -122,7 +128,7 @@ public class ComplexTypeProvider {
} else if (complexTypeName.equals(nameCTCompCollComp)) {
return new ComplexType()
- .setName("CTCompComp")
+ .setName("CTCompCollComp")
.setProperties(Arrays.asList(PropertyProvider.collPropertyComplex_CTTwoPrim));
} else if (complexTypeName.equals(nameCTPrimComp)) {
@@ -151,7 +157,9 @@ public class ComplexTypeProvider {
.setBaseType(nameCTPrimComp)
.setNavigationProperties(Arrays.asList(
PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav));
+ PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav,
+ PropertyProvider.navPropertyETKeyNavOne_ETKeyNav,
+ PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav));
} else if (complexTypeName.equals(nameCTPrimEnum)) {
return new ComplexType()
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java
index 62b11e2..5b92317 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java
@@ -211,7 +211,7 @@ public class ContainerProvider {
} else if (name.equals("AIRTETCollAllPrimParam")) {
return new ActionImport()
.setName("AIRTETCollAllPrimParam")
- .setAction(ActionProvider.nameUARTETCollAllPrimParam);
+ .setAction(ActionProvider.nameUARTESParam);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java
index 45a35c8..93e9c9d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java
@@ -71,54 +71,66 @@ public class EdmTechProvider extends EdmProvider {
);
}
+ @Override
public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
return enumTypeProvider.getEnumType(enumTypeName);
}
+ @Override
public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException {
return typeDefinitionProvider.getTypeDefinition(typeDefinitionName);
}
+ @Override
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
return entityTypeProvider.getEntityType(entityTypeName);
}
+ @Override
public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
return complexTypeProvider.getComplexType(complexTypeName);
}
+ @Override
public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
return actionProvider.getActions(actionName);
}
+ @Override
public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
return functionProvider.getFunctions(functionName);
}
+ @Override
public Term getTerm(final FullQualifiedName termName) throws ODataException {
return null;
}
+ @Override
public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
throws ODataException {
return containerProvider.getEntitySet(entityContainer, entitySetName);
}
+ @Override
public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
throws ODataException {
return containerProvider.getSingleton(entityContainer, singletonName);
}
+ @Override
public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
throws ODataException {
return containerProvider.getActionImport(entityContainer, actionImportName);
}
+ @Override
public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
throws ODataException {
return containerProvider.getFunctionImport(entityContainer, functionImportName);
}
+ @Override
public List<Schema> getSchemas() throws ODataException {
return schemaProvider.getSchemas();
}
[44/51] [abbrv] git commit: [OLINGO-230] Implementation completed
Posted by sk...@apache.org.
[OLINGO-230] Implementation completed
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/16d3b028
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/16d3b028
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/16d3b028
Branch: refs/heads/olingo-206-validator
Commit: 16d3b0288690595f36f5c8ae25249ca0e4f8a96a
Parents: 6ae704d
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Apr 2 15:29:34 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Apr 2 15:29:34 2014 +0200
----------------------------------------------------------------------
.../olingo/client/api/op/v4/ODataBinder.java | 2 +
.../communication/request/ODataRequestImpl.java | 4 +-
.../edm/AbstractEdmServiceMetadataImpl.java | 2 +-
.../client/core/op/AbstractODataBinder.java | 127 +++++-----
.../client/core/op/impl/v3/ODataBinderImpl.java | 10 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 53 +++-
.../apache/olingo/client/core/uri/URIUtils.java | 14 +-
.../olingo/client/core/v4/EntityTest.java | 28 +++
.../apache/olingo/client/core/v4/JSONTest.java | 5 +-
.../olingo/client/core/v4/atom_cleanup.xsl | 3 +-
.../olingo/client/core/v4/entity.full.json | 22 --
.../core/v4/entity.withcomplexnavigation.json | 22 ++
.../core/v4/entity.withcomplexnavigation.xml | 62 +++++
.../apache/olingo/commons/api/data/Entry.java | 16 +-
.../apache/olingo/commons/api/data/Linked.java | 38 +++
.../commons/api/data/LinkedComplexValue.java | 24 ++
.../apache/olingo/commons/api/data/Value.java | 4 +
.../commons/api/domain/CommonODataEntity.java | 76 ++----
.../olingo/commons/api/domain/ODataLinked.java | 70 ++++++
.../api/domain/v4/ODataLinkedComplexValue.java | 26 ++
.../api/domain/v4/ODataObjectFactory.java | 2 +
.../commons/api/domain/v4/ODataProperty.java | 7 +
.../commons/api/domain/v4/ODataValue.java | 14 ++
.../commons/core/data/AbstractAtomDealer.java | 2 +-
.../core/data/AbstractJsonDeserializer.java | 111 ++++++++-
.../core/data/AbstractJsonSerializer.java | 57 +++++
.../olingo/commons/core/data/AbstractValue.java | 11 +
.../commons/core/data/AtomDeserializer.java | 245 ++++++++++++++++++-
.../core/data/AtomPropertyDeserializer.java | 240 ------------------
.../core/data/AtomPropertySerializer.java | 116 ---------
.../commons/core/data/AtomSerializer.java | 92 ++++++-
.../core/data/JSONEntryDeserializer.java | 74 +-----
.../commons/core/data/JSONEntrySerializer.java | 56 +----
.../core/data/JSONPropertyDeserializer.java | 2 +-
.../core/data/LinkedComplexValueImpl.java | 47 ++++
.../domain/v4/ODataCollectionValueImpl.java | 11 +
.../core/domain/v4/ODataComplexValueImpl.java | 86 ++++++-
.../core/domain/v4/ODataEnumValueImpl.java | 10 +
.../core/domain/v4/ODataObjectFactoryImpl.java | 6 +
.../core/domain/v4/ODataPrimitiveValueImpl.java | 11 +
.../core/domain/v4/ODataPropertyImpl.java | 16 +-
41 files changed, 1149 insertions(+), 675 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
index f51c798..d2805bb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
@@ -43,4 +43,6 @@ public interface ODataBinder extends CommonODataBinder {
@Override
ODataProperty getODataProperty(Property property);
+
+ ODataProperty getODataProperty(Property property, URI base);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index 12696a6..9d38461 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -47,7 +47,6 @@ import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
@@ -389,8 +388,9 @@ public class ODataRequestImpl<T extends Format> implements ODataRequest {
}
// Add header for KeyAsSegment management
- if (odataClient.getServiceVersion() == ODataServiceVersion.V30
+ if (odataClient.getConfiguration() instanceof Configuration
&& ((Configuration) odataClient.getConfiguration()).isKeyAsSegment()) {
+
addCustomHeader(
HeaderName.dataServiceUrlConventions.toString(),
new ODataPreferences(odataClient.getServiceVersion()).keyAsSegment());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
index 12463d3..020a09a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
@@ -49,7 +49,7 @@ public abstract class AbstractEdmServiceMetadataImpl implements EdmServiceMetada
public static EdmServiceMetadata getInstance(final ODataServiceVersion version,
final List<? extends Schema> xmlSchemas) {
- return version == ODataServiceVersion.V30
+ return version.compareTo(ODataServiceVersion.V40) < 0
? new org.apache.olingo.client.core.edm.v3.EdmServiceMetadataImpl(xmlSchemas)
: new org.apache.olingo.client.core.edm.v4.EdmServiceMetadataImpl(xmlSchemas);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index c9b6b0e..71e08bb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -21,6 +21,7 @@ package org.apache.olingo.client.core.op;
import java.io.StringWriter;
import java.net.URI;
import java.util.Iterator;
+import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.ServiceDocument;
@@ -31,6 +32,7 @@ import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Linked;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
@@ -43,6 +45,7 @@ import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataLinked;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -112,6 +115,30 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
return getEntry(entity, reference, true);
}
+ protected void links(final ODataLinked odataLinked, final Linked linked, final Class<? extends Entry> reference) {
+ // -------------------------------------------------------------
+ // Append navigation links (handling inline entry / feed as well)
+ // -------------------------------------------------------------
+ // handle navigation links
+ for (ODataLink link : odataLinked.getNavigationLinks()) {
+ // append link
+ LOG.debug("Append navigation link\n{}", link);
+ linked.getNavigationLinks().add(getLink(link,
+ ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
+ }
+ // -------------------------------------------------------------
+
+ // -------------------------------------------------------------
+ // Append association links
+ // -------------------------------------------------------------
+ for (ODataLink link : odataLinked.getAssociationLinks()) {
+ LOG.debug("Append association link\n{}", link);
+ linked.getAssociationLinks().add(getLink(link,
+ ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
+ }
+ // -------------------------------------------------------------
+ }
+
@Override
public Entry getEntry(final CommonODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
final Entry entry = ResourceFactory.newEntry(reference);
@@ -139,17 +166,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
// -------------------------------------------------------------
- // -------------------------------------------------------------
- // Append navigation links (handling inline entry / feed as well)
- // -------------------------------------------------------------
- // handle navigation links
- for (ODataLink link : entity.getNavigationLinks()) {
- // append link
- LOG.debug("Append navigation link\n{}", link);
- entry.getNavigationLinks().add(getLink(link,
- ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
- }
- // -------------------------------------------------------------
+ links(entity, entry, reference);
// -------------------------------------------------------------
// Append edit-media links
@@ -161,16 +178,6 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
// -------------------------------------------------------------
- // -------------------------------------------------------------
- // Append association links
- // -------------------------------------------------------------
- for (ODataLink link : entity.getAssociationLinks()) {
- LOG.debug("Append association link\n{}", link);
- entry.getAssociationLinks().add(getLink(link,
- ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
- }
- // -------------------------------------------------------------
-
if (entity.isMediaEntity()) {
entry.setMediaContentSource(entity.getMediaContentSource());
entry.setMediaContentType(entity.getMediaContentType());
@@ -278,6 +285,34 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
return getODataEntity(resource, null);
}
+ protected void odataLinks(final Linked linked, final ODataLinked odataLinked, final URI base) {
+ for (Link link : linked.getNavigationLinks()) {
+ final Entry inlineEntry = link.getInlineEntry();
+ final Feed inlineFeed = link.getInlineFeed();
+
+ if (inlineEntry == null && inlineFeed == null) {
+ final ODataLinkType linkType = link.getType() == null
+ ? ODataLinkType.ENTITY_NAVIGATION
+ : ODataLinkType.fromString(client.getServiceVersion(), link.getRel(), link.getType());
+ odataLinked.addLink(linkType == ODataLinkType.ENTITY_NAVIGATION
+ ? client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref())
+ : client.getObjectFactory().newEntitySetNavigationLink(link.getTitle(), base, link.getHref()));
+ } else if (inlineEntry != null) {
+ odataLinked.addLink(client.getObjectFactory().newInlineEntity(
+ link.getTitle(), base, link.getHref(),
+ getODataEntity(inlineEntry,
+ inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
+ } else {
+ odataLinked.addLink(client.getObjectFactory().newInlineEntitySet(
+ link.getTitle(), base, link.getHref(),
+ getODataEntitySet(inlineFeed,
+ inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
+ }
+ }
+ }
+
+ protected abstract void copyProperties(List<Property> src, CommonODataEntity dst, final URI base);
+
@Override
public CommonODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
if (LOG.isDebugEnabled()) {
@@ -292,7 +327,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final CommonODataEntity entity = resource.getSelfLink() == null
? client.getObjectFactory().newEntity(resource.getType())
: client.getObjectFactory().newEntity(resource.getType(),
- URIUtils.getURI(base, resource.getSelfLink().getHref()));
+ URIUtils.getURI(base, resource.getSelfLink().getHref()));
if (StringUtils.isNotBlank(resource.getETag())) {
entity.setETag(resource.getETag());
@@ -306,29 +341,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
entity.addLink(client.getObjectFactory().newAssociationLink(link.getTitle(), base, link.getHref()));
}
- for (Link link : resource.getNavigationLinks()) {
- final Entry inlineEntry = link.getInlineEntry();
- final Feed inlineFeed = link.getInlineFeed();
-
- if (inlineEntry == null && inlineFeed == null) {
- final ODataLinkType linkType = link.getType() == null
- ? ODataLinkType.ENTITY_NAVIGATION
- : ODataLinkType.fromString(client.getServiceVersion(), link.getRel(), link.getType());
- entity.addLink(linkType == ODataLinkType.ENTITY_NAVIGATION
- ? client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref())
- : client.getObjectFactory().newEntitySetNavigationLink(link.getTitle(), base, link.getHref()));
- } else if (inlineEntry != null) {
- entity.addLink(client.getObjectFactory().newInlineEntity(
- link.getTitle(), base, link.getHref(),
- getODataEntity(inlineEntry,
- inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
- } else {
- entity.addLink(client.getObjectFactory().newInlineEntitySet(
- link.getTitle(), base, link.getHref(),
- getODataEntitySet(inlineFeed,
- inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
- }
- }
+ odataLinks(resource, entity, base);
for (Link link : resource.getMediaEditLinks()) {
entity.addLink(client.getObjectFactory().newMediaEditLink(link.getTitle(), base, link.getHref()));
@@ -346,14 +359,12 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
entity.setMediaETag(resource.getMediaETag());
}
- for (Property property : resource.getProperties()) {
- add(entity, getODataProperty(property));
- }
+ copyProperties(resource.getProperties(), entity, base);
return entity;
}
- protected ODataValue getODataValue(final Property resource) {
+ protected ODataValue getODataValue(final Property resource, final URI base) {
ODataValue value = null;
final EdmTypeInfo typeInfo = resource.getType() == null
@@ -363,18 +374,18 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setText(resource.getValue().asPrimitive().get()).
setType(typeInfo == null
- ? null
- : EdmPrimitiveTypeKind.valueOfFQN(
- client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
+ ? null
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isGeospatial()) {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setValue(resource.getValue().asGeospatial().get()).
setType(typeInfo == null
- || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
- || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
- ? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
- : EdmPrimitiveTypeKind.valueOfFQN(
- client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
+ ? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isComplex()) {
value = client.getObjectFactory().newComplexValue(typeInfo == null
? null : typeInfo.getFullQualifiedName().toString());
@@ -389,7 +400,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
for (Value _value : resource.getValue().asCollection().get()) {
final JSONPropertyImpl fake = new JSONPropertyImpl();
fake.setValue(_value);
- value.asCollection().add(getODataValue(fake));
+ value.asCollection().add(getODataValue(fake, base));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
index 50deadd..ab973d3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
@@ -19,6 +19,7 @@
package org.apache.olingo.client.core.op.impl.v3;
import java.net.URI;
+import java.util.List;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.op.v3.ODataBinder;
@@ -86,6 +87,13 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ protected void copyProperties(final List<Property> src, final CommonODataEntity dst, final URI base) {
+ for (Property property : src) {
+ add(dst, getODataProperty(property));
+ }
+ }
+
+ @Override
public ODataEntity getODataEntity(final Entry resource) {
return (ODataEntity) super.getODataEntity(resource);
}
@@ -97,7 +105,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
@Override
public ODataProperty getODataProperty(final Property property) {
- return new ODataPropertyImpl(property.getName(), getODataValue(property));
+ return new ODataPropertyImpl(property.getName(), getODataValue(property, null));
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/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 226d8b8..adce2ee 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
@@ -19,6 +19,7 @@
package org.apache.olingo.client.core.op.impl.v4;
import java.net.URI;
+import java.util.List;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
import org.apache.olingo.client.api.op.v4.ODataBinder;
@@ -27,6 +28,7 @@ import org.apache.olingo.client.core.op.AbstractODataBinder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.LinkedComplexValue;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
@@ -36,8 +38,10 @@ import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.core.data.EnumValueImpl;
+import org.apache.olingo.commons.core.data.LinkedComplexValueImpl;
import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.core.op.ResourceFactory;
@@ -125,6 +129,19 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
((org.apache.olingo.commons.api.domain.v4.ODataValue) value).asEnum().getValue());
} else {
valueResource = super.getValue(value, reference, setType);
+
+ if (value instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
+ && ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).isLinkedComplex()) {
+
+ final LinkedComplexValue lcValueResource = new LinkedComplexValueImpl();
+ lcValueResource.get().addAll(valueResource.asComplex().get());
+
+ final ODataLinkedComplexValue linked =
+ ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).asLinkedComplex();
+ links(linked, lcValueResource, reference);
+
+ valueResource = lcValueResource;
+ }
}
return valueResource;
}
@@ -140,6 +157,13 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ protected void copyProperties(final List<Property> src, final CommonODataEntity dst, final URI base) {
+ for (Property property : src) {
+ add(dst, getODataProperty(property, base));
+ }
+ }
+
+ @Override
public ODataEntity getODataEntity(final Entry resource) {
return (ODataEntity) super.getODataEntity(resource);
}
@@ -153,21 +177,38 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
@Override
public ODataProperty getODataProperty(final Property property) {
- return new ODataPropertyImpl(property.getName(), getODataValue(property));
+ return getODataProperty(property, null);
}
@Override
- protected ODataValue getODataValue(final Property resource) {
+ public ODataProperty getODataProperty(final Property property, final URI base) {
+ return new ODataPropertyImpl(property.getName(), getODataValue(property, base));
+ }
+
+ @Override
+ protected ODataValue getODataValue(final Property resource, final URI base) {
+ final EdmTypeInfo typeInfo = resource.getType() == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(resource.getType()).build();
+
ODataValue value;
if (resource.getValue().isEnum()) {
- final EdmTypeInfo typeInfo = resource.getType() == null
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(resource.getType()).build();
value = ((ODataClient) client).getObjectFactory().newEnumValue(
typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(),
resource.getValue().asEnum().get());
+ } else if (resource.getValue().isLinkedComplex()) {
+ final ODataLinkedComplexValue lcValue = ((ODataClient) client).getObjectFactory().
+ newLinkedComplexValue(typeInfo == null ? null : typeInfo.getFullQualifiedName().toString());
+
+ for (Property property : resource.getValue().asComplex().get()) {
+ lcValue.add(getODataProperty(property));
+ }
+
+ odataLinks(resource.getValue().asLinkedComplex(), lcValue, base);
+
+ value = lcValue;
} else {
- value = super.getODataValue(resource);
+ value = super.getODataValue(resource, base);
}
return value;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 17cfcd0..94eccf5 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -161,7 +161,7 @@ public final class URIUtils {
private static String prefix(final ODataServiceVersion version, final EdmPrimitiveTypeKind typeKind) {
String result = StringUtils.EMPTY;
- if (version == ODataServiceVersion.V30) {
+ if (version.compareTo(ODataServiceVersion.V40) < 0) {
switch (typeKind) {
case Guid:
result = "guid'";
@@ -188,7 +188,7 @@ public final class URIUtils {
private static String suffix(final ODataServiceVersion version, final EdmPrimitiveTypeKind typeKind) {
String result = StringUtils.EMPTY;
- if (version == ODataServiceVersion.V30) {
+ if (version.compareTo(ODataServiceVersion.V40) < 0) {
switch (typeKind) {
case Guid:
case DateTime:
@@ -222,7 +222,7 @@ public final class URIUtils {
private static String timestamp(final ODataServiceVersion version, final Timestamp timestamp)
throws UnsupportedEncodingException, EdmPrimitiveTypeException {
- return version == ODataServiceVersion.V30
+ return version.compareTo(ODataServiceVersion.V40) < 0
? prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
@@ -238,7 +238,7 @@ public final class URIUtils {
String result;
if (calendar.get(Calendar.ZONE_OFFSET) == 0) {
- if (version == ODataServiceVersion.V30) {
+ if (version.compareTo(ODataServiceVersion.V40) < 0) {
result = prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
@@ -271,7 +271,7 @@ public final class URIUtils {
private static String duration(final ODataServiceVersion version, final Duration duration)
throws UnsupportedEncodingException, EdmPrimitiveTypeException {
- return version == ODataServiceVersion.V30
+ return version.compareTo(ODataServiceVersion.V40) < 0
? EdmTime.getInstance().toUriLiteral(URLEncoder.encode(EdmTime.getInstance().
valueToString(duration, null, null,
Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
@@ -308,7 +308,7 @@ public final class URIUtils {
try {
if (obj == null) {
value = Constants.ATTR_NULL;
- } else if (version == ODataServiceVersion.V40 && obj instanceof Collection) {
+ } else if (version.compareTo(ODataServiceVersion.V40) >= 0 && obj instanceof Collection) {
final StringBuffer buffer = new StringBuffer("[");
for (@SuppressWarnings("unchecked")
final Iterator<Object> itor = ((Collection<Object>) obj).iterator(); itor.hasNext();) {
@@ -320,7 +320,7 @@ public final class URIUtils {
buffer.append(']');
value = buffer.toString();
- } else if (version == ODataServiceVersion.V40 && obj instanceof Map) {
+ } else if (version.compareTo(ODataServiceVersion.V40) >= 0 && obj instanceof Map) {
final StringBuffer buffer = new StringBuffer("{");
for (@SuppressWarnings("unchecked")
final Iterator<Map.Entry<Object, Object>> itor =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index 5b8f586..8717c3c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -31,6 +31,7 @@ import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -247,4 +248,31 @@ public class EntityTest extends AbstractTest {
public void jsonRef() {
ref(ODataPubFormat.JSON);
}
+
+ private void complexNavigationProperties(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("entity.withcomplexnavigation." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ final ODataLinkedComplexValue addressValue = entity.getProperty("Address").getLinkedComplexValue();
+ assertNotNull(addressValue);
+ assertNotNull(addressValue.getNavigationLink("Country"));
+
+ // ETag is not serialized
+ entity.setETag(null);
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomComplexNavigationProperties() {
+ complexNavigationProperties(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonComplexNavigationProperties() {
+ complexNavigationProperties(ODataPubFormat.JSON);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/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
index 791c1c7..8bd3245 100644
--- 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
@@ -58,6 +58,9 @@ public class JSONTest extends AbstractTest {
if (node.has(Constants.JSON_CONTEXT)) {
node.remove(Constants.JSON_CONTEXT);
}
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ETAG))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ETAG));
+ }
if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))) {
node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE));
}
@@ -140,7 +143,6 @@ public class JSONTest extends AbstractTest {
@Test
public void additionalEntries() throws Exception {
entry("entity.minimal", getODataPubFormat());
-// entry("entity.full", getODataPubFormat());
entry("entity.primitive", getODataPubFormat());
entry("entity.complex", getODataPubFormat());
entry("entity.collection.primitive", getODataPubFormat());
@@ -153,6 +155,7 @@ public class JSONTest extends AbstractTest {
entry("VipCustomer", getODataPubFormat());
entry("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
entry("entityReference", getODataPubFormat());
+ entry("entity.withcomplexnavigation", getODataPubFormat());
}
protected void property(final String filename, final ODataFormat format) throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl
index ed30201..f80a315 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl
@@ -27,6 +27,7 @@
<xsl:template match="atom:updated"/>
<xsl:template match="atom:author"/>
+ <xsl:template match="atom:summary"/>
<xsl:template match="atom:title">
<xsl:if test="string-length(.) > 0">
<title type="{@type}">
@@ -38,7 +39,7 @@
<xsl:template match="m:action"/>
- <xsl:template match="@*[name() = 'm:etag' or name() = 'm:context']"/>
+ <xsl:template match="@*[name() = 'm:etag' or name() = 'm:context' or name() = 'm:metadata-etag']"/>
<xsl:template match="node()|@*">
<xsl:copy>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.json
deleted file mode 100644
index bcd1dba..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "@odata.context": "http://host/service/$metadata#Customers/$entity",
- "@odata.id": "Customers('ALFKI')",
- "@odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
- "@odata.editLink": "Customers('ALFKI')",
- "ID": "ALFKI",
- "CompanyName": "Alfreds Futterkiste",
- "ContactName": "Maria Anders",
- "ContactTitle": "Sales Representative",
- "Phone": "030-0074321",
- "Fax": "030-0076545",
- "Address": {
- "Street": "Obere Str. 57",
- "City": "Berlin",
- "Region": null,
- "PostalCode": "D-12209",
- "Country@odata.associationLink": "Customers('ALFKI')/Address/Country/$ref",
- "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country"
- },
- "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
- "Orders@odata.navigationLink": "Customers('ALFKI')/Orders"
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.json
new file mode 100644
index 0000000..bcd1dba
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.json
@@ -0,0 +1,22 @@
+{
+ "@odata.context": "http://host/service/$metadata#Customers/$entity",
+ "@odata.id": "Customers('ALFKI')",
+ "@odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
+ "@odata.editLink": "Customers('ALFKI')",
+ "ID": "ALFKI",
+ "CompanyName": "Alfreds Futterkiste",
+ "ContactName": "Maria Anders",
+ "ContactTitle": "Sales Representative",
+ "Phone": "030-0074321",
+ "Fax": "030-0076545",
+ "Address": {
+ "Street": "Obere Str. 57",
+ "City": "Berlin",
+ "Region": null,
+ "PostalCode": "D-12209",
+ "Country@odata.associationLink": "Customers('ALFKI')/Address/Country/$ref",
+ "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country"
+ },
+ "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
+ "Orders@odata.navigationLink": "Customers('ALFKI')/Orders"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.xml
new file mode 100644
index 0000000..1a4e0cc
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<entry xmlns="http://www.w3.org/2005/Atom"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xml:base="http://host/service/"
+ m:context="$metadata#Customers/$entity"
+ m:metadata-etag="W/"MjAxMy0wNS0xM1QxNDo1NFo="">
+ <id>http://host/service/$metadata#Customers('ALFKI')</id>
+ <title/>
+ <summary/>
+ <updated>2012-03-30T07:11:05Z</updated>
+ <author>
+ <name/>
+ </author>
+ <link rel="edit" title="Customer" href="Customers('ALFKI')"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders"
+ type="application/atom+xml;type=feed"
+ title="Orders" href="Customers('ALFKI')/Orders"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Supplier"
+ type="application/atom+xml;type=entry"
+ title="Supplier" href="Customers('ALFKI')/Supplier"/>
+ <category term="#ODataDemo.Customer"
+ scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <content type="application/xml">
+ <m:properties>
+ <d:ID>ALFKI</d:ID>
+ <d:CompanyName>Alfreds Futterkiste</d:CompanyName>
+ <d:ContactName>Maria Anders</d:ContactName>
+ <d:ContactTitle>Sales Representative</d:ContactTitle>
+ <d:Phone>030-0074321</d:Phone>
+ <d:Fax>030-0076545</d:Fax>
+ <d:Address>
+ <d:Street>Obere Str. 57</d:Street>
+ <d:City>Berlin</d:City>
+ <d:Region m:null="true"/>
+ <d:PostalCode>D-12209</d:PostalCode>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Country"
+ type="application/atom+xml;type=entry"
+ title="Country"
+ href="Customers('ALFKI')/Address/Country"/>
+ </d:Address>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
index 5e24e8a..d82005e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
@@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.domain.ODataOperation;
import java.net.URI;
import java.util.List;
-public interface Entry {
+public interface Entry extends Linked {
/**
* Gets ETag.
@@ -95,20 +95,6 @@ public interface Entry {
void setEditLink(Link editLink);
/**
- * Gets association links.
- *
- * @return association links.
- */
- List<Link> getAssociationLinks();
-
- /**
- * Gets navigation links.
- *
- * @return links.
- */
- List<Link> getNavigationLinks();
-
- /**
* Gets media entity links.
*
* @return links.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java
new file mode 100644
index 0000000..b5c7db7
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java
@@ -0,0 +1,38 @@
+/*
+ * 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.commons.api.data;
+
+import java.util.List;
+
+public interface Linked {
+
+ /**
+ * Gets association links.
+ *
+ * @return association links.
+ */
+ List<Link> getAssociationLinks();
+
+ /**
+ * Gets navigation links.
+ *
+ * @return links.
+ */
+ List<Link> getNavigationLinks();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java
new file mode 100644
index 0000000..13cb72c
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java
@@ -0,0 +1,24 @@
+/*
+ * 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.commons.api.data;
+
+public interface LinkedComplexValue extends ComplexValue, Linked {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
index b02f1ba..08a420d 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
@@ -30,6 +30,8 @@ public interface Value {
boolean isComplex();
+ boolean isLinkedComplex();
+
boolean isCollection();
Object get();
@@ -44,5 +46,7 @@ public interface Value {
ComplexValue asComplex();
+ LinkedComplexValue asLinkedComplex();
+
CollectionValue asCollection();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
index 6d832c8..7827c68 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
@@ -24,13 +24,27 @@ import java.util.List;
/**
* OData entity.
*/
-public interface CommonODataEntity extends ODataInvokeResult {
+public interface CommonODataEntity extends ODataLinked, ODataInvokeResult {
String getName();
URI getLink();
/**
+ * Returns OData entity edit link.
+ *
+ * @return entity edit link.
+ */
+ URI getEditLink();
+
+ /**
+ * Sets OData entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ void setEditLink(URI editLink);
+
+ /**
* Gets ETag.
*
* @return ETag.
@@ -75,52 +89,6 @@ public interface CommonODataEntity extends ODataInvokeResult {
List<? extends CommonODataProperty> getProperties();
/**
- * Puts the given link into one of available lists, based on its type.
- *
- * @param link to be added
- * @return <tt>true</tt> if the given link was added in one of available lists
- */
- boolean addLink(ODataLink link);
-
- /**
- * Removes the given link from any list (association, navigation, edit-media).
- *
- * @param link to be removed
- * @return <tt>true</tt> if the given link was contained in one of available lists
- */
- boolean removeLink(ODataLink link);
-
- /**
- * Gets association link with given name, if available, otherwise <tt>null</tt>.
- *
- * @param name candidate link name
- * @return association link with given name, if available, otherwise <tt>null</tt>
- */
- ODataLink getAssociationLink(String name);
-
- /**
- * Returns all entity association links.
- *
- * @return OData entity links.
- */
- List<ODataLink> getAssociationLinks();
-
- /**
- * Gets navigation link with given name, if available, otherwise <tt>null</tt>.
- *
- * @param name candidate link name
- * @return navigation link with given name, if available, otherwise <tt>null</tt>
- */
- ODataLink getNavigationLink(String name);
-
- /**
- * Returns all entity navigation links (including inline entities / feeds).
- *
- * @return OData entity links.
- */
- List<ODataLink> getNavigationLinks();
-
- /**
* Gets media-edit link with given name, if available, otherwise <tt>null</tt>.
*
* @param name candidate link name
@@ -136,20 +104,6 @@ public interface CommonODataEntity extends ODataInvokeResult {
List<ODataLink> getEditMediaLinks();
/**
- * Returns OData entity edit link.
- *
- * @return entity edit link.
- */
- URI getEditLink();
-
- /**
- * Sets OData entity edit link.
- *
- * @param editLink edit link.
- */
- void setEditLink(URI editLink);
-
- /**
* TRUE if read-only entity.
*
* @return TRUE if read-only; FALSE otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java
new file mode 100644
index 0000000..0dd5462
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java
@@ -0,0 +1,70 @@
+/*
+ * 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.commons.api.domain;
+
+import java.util.List;
+
+public interface ODataLinked {
+
+ /**
+ * Puts the given link into one of available lists, based on its type.
+ *
+ * @param link to be added
+ * @return <tt>true</tt> if the given link was added in one of available lists
+ */
+ boolean addLink(ODataLink link);
+
+ /**
+ * Removes the given link from any list (association, navigation, edit-media).
+ *
+ * @param link to be removed
+ * @return <tt>true</tt> if the given link was contained in one of available lists
+ */
+ boolean removeLink(ODataLink link);
+
+ /**
+ * Gets association link with given name, if available, otherwise <tt>null</tt>.
+ *
+ * @param name candidate link name
+ * @return association link with given name, if available, otherwise <tt>null</tt>
+ */
+ ODataLink getAssociationLink(String name);
+
+ /**
+ * Returns all entity association links.
+ *
+ * @return OData entity links.
+ */
+ List<ODataLink> getAssociationLinks();
+
+ /**
+ * Gets navigation link with given name, if available, otherwise <tt>null</tt>.
+ *
+ * @param name candidate link name
+ * @return navigation link with given name, if available, otherwise <tt>null</tt>
+ */
+ ODataLink getNavigationLink(String name);
+
+ /**
+ * Returns all entity navigation links (including inline entities / feeds).
+ *
+ * @return OData entity links.
+ */
+ List<ODataLink> getNavigationLinks();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java
new file mode 100644
index 0000000..a54be59
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java
@@ -0,0 +1,26 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataLinked;
+
+public interface ODataLinkedComplexValue extends ODataValue, ODataLinked, ODataComplexValue<ODataProperty> {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
index 67adf57..b493392 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
@@ -44,6 +44,8 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
@Override
ODataComplexValue<ODataProperty> newComplexValue(String typeName);
+ ODataLinkedComplexValue newLinkedComplexValue(String typeName);
+
@Override
ODataCollectionValue<ODataValue> newCollectionValue(String typeName);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
index 4666e6e..4031486 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
@@ -37,6 +37,13 @@ public interface ODataProperty extends CommonODataProperty {
* @return complex value if exists; null otherwise.
*/
ODataComplexValue<ODataProperty> getComplexValue();
+
+ /**
+ * Gets complex value with link information (if available).
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ ODataLinkedComplexValue getLinkedComplexValue();
/**
* Checks if has enum value.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
index 1535e10..a8f5dff 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
@@ -21,6 +21,20 @@ package org.apache.olingo.commons.api.domain.v4;
public interface ODataValue extends org.apache.olingo.commons.api.domain.ODataValue {
/**
+ * Check is is a linked complex value.
+ *
+ * @return 'TRUE' if linked complex; 'FALSE' otherwise.
+ */
+ boolean isLinkedComplex();
+
+ /**
+ * Casts to complex value with link information (if available).
+ *
+ * @return complex value with link information.
+ */
+ ODataLinkedComplexValue asLinkedComplex();
+
+ /**
* Check is is an enum value.
*
* @return 'TRUE' if enum; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index f4944d6..f571c66 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -81,7 +81,7 @@ abstract class AbstractAtomDealer {
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
this.typeQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_TYPE);
this.nullQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_NULL);
- this.elementQName = version == ODataServiceVersion.V30
+ this.elementQName = version.compareTo(ODataServiceVersion.V40) < 0
? new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_ELEMENT)
: new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ELEM_ELEMENT);
this.countQName =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
index 6731259..59712e5 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@ -18,17 +18,26 @@
*/
package org.apache.olingo.commons.core.data;
+import com.fasterxml.jackson.core.ObjectCodec;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Linked;
import org.apache.olingo.commons.api.data.Value;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.ODataPropertyType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Container<T>> {
@@ -42,6 +51,76 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Cont
return geoDeserializer;
}
+ protected String getTitle(final Map.Entry<String, JsonNode> entry) {
+ return entry.getKey().substring(0, entry.getKey().indexOf('@'));
+ }
+
+ protected String setInline(final String name, final String suffix, final JsonNode tree,
+ final ObjectCodec codec, final LinkImpl link) throws IOException {
+
+ final String entryNamePrefix = name.substring(0, name.indexOf(suffix));
+ if (tree.has(entryNamePrefix)) {
+ final JsonNode inline = tree.path(entryNamePrefix);
+
+ if (inline instanceof ObjectNode) {
+ link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
+
+ link.setInlineEntry(inline.traverse(codec).<Container<JSONEntryImpl>>readValueAs(
+ new TypeReference<JSONEntryImpl>() {
+ }).getObject());
+ }
+
+ if (inline instanceof ArrayNode) {
+ link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
+
+ final JSONFeedImpl feed = new JSONFeedImpl();
+ final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
+ while (entries.hasNext()) {
+ feed.getEntries().add(entries.next().traverse(codec).<Container<JSONEntryImpl>>readValuesAs(
+ new TypeReference<JSONEntryImpl>() {
+ }).next().getObject());
+ }
+
+ link.setInlineFeed(feed);
+ }
+ }
+ return entryNamePrefix;
+ }
+
+ protected void links(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
+ final JsonNode tree, final ObjectCodec codec) throws IOException {
+
+ if (field.getKey().endsWith(jsonNavigationLink)) {
+ final LinkImpl link = new LinkImpl();
+ link.setTitle(getTitle(field));
+ link.setRel(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + getTitle(field));
+
+ if (field.getValue().isValueNode()) {
+ link.setHref(field.getValue().textValue());
+ link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
+ }
+ // NOTE: this should be expected to happen, but it isn't - at least up to OData 4.0
+ /* if (field.getValue().isArray()) {
+ * link.setHref(field.getValue().asText());
+ * link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
+ * } */
+
+ linked.getNavigationLinks().add(link);
+
+ toRemove.add(field.getKey());
+ toRemove.add(setInline(field.getKey(), jsonNavigationLink, tree, codec, link));
+ } else if (field.getKey().endsWith(jsonAssociationLink)) {
+ final LinkImpl link = new LinkImpl();
+ link.setTitle(getTitle(field));
+ link.setRel(version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL) + getTitle(field));
+ link.setHref(field.getValue().textValue());
+ link.setType(ODataLinkType.ASSOCIATION.toString());
+ linked.getAssociationLinks().add(link);
+
+ toRemove.add(field.getKey());
+ }
+ }
+
protected EdmPrimitiveTypeKind getPrimitiveType(final JsonNode node) {
EdmPrimitiveTypeKind result = EdmPrimitiveTypeKind.String;
@@ -88,8 +167,20 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Cont
return value;
}
- private ComplexValue fromComplex(final JsonNode node) {
- final ComplexValue value = new ComplexValueImpl();
+ private ComplexValue fromComplex(final ObjectNode node, final ObjectCodec codec) throws IOException {
+ final ComplexValue value = version.compareTo(ODataServiceVersion.V40) < 0
+ ? new ComplexValueImpl()
+ : new LinkedComplexValueImpl();
+
+ if (value.isLinkedComplex()) {
+ final Set<String> toRemove = new HashSet<String>();
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+
+ links(field, value.asLinkedComplex(), toRemove, node, codec);
+ }
+ node.remove(toRemove);
+ }
String type = null;
for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
@@ -103,7 +194,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Cont
property.setType(type);
type = null;
- value(property, field.getValue());
+ value(property, field.getValue(), codec);
value.get().add(property);
}
}
@@ -111,7 +202,9 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Cont
return value;
}
- private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo) {
+ private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo,
+ final ObjectCodec codec) throws IOException {
+
final CollectionValueImpl value = new CollectionValueImpl();
final EdmTypeInfo type = typeInfo == null
@@ -131,14 +224,16 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Cont
if (child.has(jsonType)) {
((ObjectNode) child).remove(jsonType);
}
- value.get().add(fromComplex(child));
+ value.get().add(fromComplex((ObjectNode) child, codec));
}
}
return value;
}
- protected void value(final JSONPropertyImpl property, final JsonNode node) {
+ protected void value(final JSONPropertyImpl property, final JsonNode node, final ObjectCodec codec)
+ throws IOException {
+
final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
? null
: new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
@@ -155,7 +250,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Cont
switch (propType) {
case COLLECTION:
- property.setValue(fromCollection(node.elements(), typeInfo));
+ property.setValue(fromCollection(node.elements(), typeInfo, codec));
break;
case COMPLEX:
@@ -163,7 +258,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Cont
property.setType(node.get(jsonType).asText());
((ObjectNode) node).remove(jsonType);
}
- property.setValue(fromComplex(node));
+ property.setValue(fromComplex((ObjectNode) node, codec));
break;
case ENUM:
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
index dede6aa..76451d1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
@@ -20,12 +20,22 @@ package org.apache.olingo.commons.core.data;
import com.fasterxml.jackson.core.JsonGenerator;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.CollectionValue;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Linked;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.Value;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
@@ -39,6 +49,50 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
private final JSONGeoValueSerializer geoSerializer = new JSONGeoValueSerializer();
+ protected void links(final Linked linked, final JsonGenerator jgen) throws IOException {
+ final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
+ for (Link link : linked.getNavigationLinks()) {
+ ODataLinkType type = null;
+ try {
+ type = ODataLinkType.fromString(version, link.getRel(), link.getType());
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+
+ if (type == ODataLinkType.ENTITY_SET_NAVIGATION) {
+ final List<String> uris;
+ if (entitySetLinks.containsKey(link.getTitle())) {
+ uris = entitySetLinks.get(link.getTitle());
+ } else {
+ uris = new ArrayList<String>();
+ entitySetLinks.put(link.getTitle(), uris);
+ }
+ uris.add(link.getHref());
+ } else {
+ if (StringUtils.isNotBlank(link.getHref())) {
+ jgen.writeStringField(link.getTitle() + Constants.JSON_BIND_LINK_SUFFIX, link.getHref());
+ }
+ }
+
+ if (link.getInlineEntry() != null) {
+ jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
+ } else if (link.getInlineFeed() != null) {
+ jgen.writeArrayFieldStart(link.getTitle());
+ for (Entry subEntry : link.getInlineFeed().getEntries()) {
+ jgen.writeObject(subEntry);
+ }
+ jgen.writeEndArray();
+ }
+ }
+ for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
+ jgen.writeArrayFieldStart(entitySetLink.getKey() + Constants.JSON_BIND_LINK_SUFFIX);
+ for (String uri : entitySetLink.getValue()) {
+ jgen.writeString(uri);
+ }
+ jgen.writeEndArray();
+ }
+ }
+
private void collection(final JsonGenerator jgen, final String itemType, final CollectionValue value)
throws IOException {
@@ -85,6 +139,9 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
for (Property property : value.asComplex().get()) {
property(jgen, property, property.getName());
}
+ if (value.isLinkedComplex()) {
+ links(value.asLinkedComplex(), jgen);
+ }
jgen.writeEndObject();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
index 629592f..2d91ffd 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
@@ -26,6 +26,7 @@ import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.EnumValue;
import org.apache.olingo.commons.api.data.GeospatialValue;
+import org.apache.olingo.commons.api.data.LinkedComplexValue;
import org.apache.olingo.commons.api.data.NullValue;
import org.apache.olingo.commons.api.data.PrimitiveValue;
import org.apache.olingo.commons.api.data.Value;
@@ -58,6 +59,11 @@ public abstract class AbstractValue implements Value {
}
@Override
+ public boolean isLinkedComplex() {
+ return false;
+ }
+
+ @Override
public boolean isCollection() {
return false;
}
@@ -88,6 +94,11 @@ public abstract class AbstractValue implements Value {
}
@Override
+ public LinkedComplexValue asLinkedComplex() {
+ return isLinkedComplex() ? (LinkedComplexValue) this : null;
+ }
+
+ @Override
public CollectionValue asCollection() {
return isCollection() ? (CollectionValue) this : null;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index c748f59..1ead6cb 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -29,27 +29,264 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
+import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.CollectionValue;
+import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.ODataPropertyType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.data.v3.XMLLinkCollectionImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
public class AtomDeserializer extends AbstractAtomDealer {
private static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
- private final AtomPropertyDeserializer propDeserializer;
+ private final AtomGeoValueDeserializer geoDeserializer;
public AtomDeserializer(final ODataServiceVersion version) {
super(version);
- this.propDeserializer = new AtomPropertyDeserializer(version);
+ this.geoDeserializer = new AtomGeoValueDeserializer();
+ }
+
+ private Value fromPrimitive(final XMLEventReader reader, final StartElement start,
+ final EdmTypeInfo typeInfo) throws XMLStreamException {
+
+ Value value = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
+ version, typeInfo.getFullQualifiedName().toString());
+ value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
+ && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
+
+ value = new PrimitiveValueImpl(event.asCharacters().getData());
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value == null ? new PrimitiveValueImpl(StringUtils.EMPTY) : value;
+ }
+
+ private Value fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException {
+
+ Value value = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (value == null) {
+ value = version.compareTo(ODataServiceVersion.V40) < 0
+ ? new ComplexValueImpl()
+ : new LinkedComplexValueImpl();
+ }
+
+ if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final LinkImpl link = new LinkImpl();
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null) {
+ link.setRel(rel.getValue());
+ }
+ final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
+ if (title != null) {
+ link.setTitle(title.getValue());
+ }
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ link.setHref(href.getValue());
+ }
+ final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
+ if (type != null) {
+ link.setType(type.getValue());
+ }
+
+ if (link.getRel().startsWith(
+ version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) {
+
+ value.asLinkedComplex().getNavigationLinks().add(link);
+ inline(reader, event.asStartElement(), link);
+ } else if (link.getRel().startsWith(
+ version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL))) {
+
+ value.asLinkedComplex().getAssociationLinks().add(link);
+ }
+ } else {
+ value.asComplex().get().add(property(reader, event.asStartElement()));
+ }
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ value = new EnumValueImpl(event.asCharacters().getData());
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private CollectionValue fromCollection(final XMLEventReader reader, final StartElement start,
+ final EdmTypeInfo typeInfo) throws XMLStreamException {
+
+ final CollectionValueImpl value = new CollectionValueImpl();
+
+ final EdmTypeInfo type = typeInfo == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ switch (guessPropertyType(reader, typeInfo)) {
+ case COMPLEX:
+ case ENUM:
+ value.get().add(fromComplexOrEnum(reader, event.asStartElement()));
+ break;
+
+ case PRIMITIVE:
+ value.get().add(fromPrimitive(reader, event.asStartElement(), type));
+ break;
+
+ default:
+ // do not add null or empty values
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private ODataPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo)
+ throws XMLStreamException {
+
+ XMLEvent child = null;
+ while (reader.hasNext() && child == null) {
+ final XMLEvent event = reader.peek();
+ if (event.isCharacters() && event.asCharacters().isWhiteSpace()) {
+ reader.nextEvent();
+ } else {
+ child = event;
+ }
+ }
+
+ final ODataPropertyType type;
+ if (child == null) {
+ type = typeInfo == null || typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.ENUM;
+ } else {
+ if (child.isStartElement()) {
+ if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else if (elementQName.equals(child.asStartElement().getName())) {
+ type = ODataPropertyType.COLLECTION;
+ } else {
+ type = ODataPropertyType.COMPLEX;
+ }
+ } else if (child.isCharacters()) {
+ type = typeInfo == null || typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.ENUM;
+ } else {
+ type = ODataPropertyType.EMPTY;
+ }
+ }
+
+ return type;
+ }
+
+ private AtomPropertyImpl property(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException {
+
+ final AtomPropertyImpl property = new AtomPropertyImpl();
+
+ if (ODataServiceVersion.V40 == version && v4PropertyValueQName.equals(start.getName())) {
+ // retrieve name from context
+ final Attribute context = start.getAttributeByName(contextQName);
+ if (context != null) {
+ property.setName(StringUtils.substringAfterLast(context.getValue(), "/"));
+ }
+ } else {
+ property.setName(start.getName().getLocalPart());
+ }
+
+ final Attribute nullAttr = start.getAttributeByName(this.nullQName);
+
+ Value value;
+ if (nullAttr == null) {
+ final Attribute typeAttr = start.getAttributeByName(this.typeQName);
+ final String typeAttrValue = typeAttr == null ? null : typeAttr.getValue();
+
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(typeAttrValue)
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(typeAttrValue).build();
+
+ if (typeInfo != null) {
+ property.setType(typeInfo.getTypeExpression());
+ }
+
+ final ODataPropertyType propType = typeInfo == null
+ ? guessPropertyType(reader, typeInfo)
+ : typeInfo.isCollection()
+ ? ODataPropertyType.COLLECTION
+ : typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.COMPLEX;
+
+ switch (propType) {
+ case COLLECTION:
+ value = fromCollection(reader, start, typeInfo);
+ break;
+
+ case COMPLEX:
+ value = fromComplexOrEnum(reader, start);
+ break;
+
+ case PRIMITIVE:
+ value = fromPrimitive(reader, start, typeInfo);
+ break;
+
+ case EMPTY:
+ default:
+ value = new PrimitiveValueImpl(StringUtils.EMPTY);
+ }
+ } else {
+ value = new NullValueImpl();
+ }
+
+ property.setValue(value);
+
+ return property;
}
private Container<AtomPropertyImpl> property(final InputStream input) throws XMLStreamException {
final XMLEventReader reader = FACTORY.createXMLEventReader(input);
final StartElement start = skipBeforeFirstStartElement(reader);
- return getContainer(start, propDeserializer.deserialize(reader, start));
+ return getContainer(start, property(reader, start));
}
private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
@@ -162,7 +399,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
final XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
- entry.getProperties().add(propDeserializer.deserialize(reader, event.asStartElement()));
+ entry.getProperties().add(property(reader, event.asStartElement()));
}
if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
[37/51] [abbrv] git commit: [OLINGO-168] Refactoring
Posted by sk...@apache.org.
[OLINGO-168] Refactoring
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/7c2dac9c
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/7c2dac9c
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/7c2dac9c
Branch: refs/heads/olingo-206-validator
Commit: 7c2dac9c22f8785797bd293ef67f995a16ca60b6
Parents: 6a3a4a1
Author: Christian Amend <ch...@apache.org>
Authored: Wed Apr 2 09:16:05 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Wed Apr 2 09:18:02 2014 +0200
----------------------------------------------------------------------
.../json/ServiceDocumentJsonSerializer.java | 4 +-
.../xml/MetadataDocumentXmlSerializer.java | 14 +-
.../server/core/uri/parser/UriContext.java | 4 +-
.../serializer/xml/MetadataDocumentTest.java | 3 +-
.../testutil/techprovider/ActionProvider.java | 8 +-
.../techprovider/ComplexTypeProvider.java | 8 +-
.../testutil/techprovider/PropertyProvider.java | 174 +++++++++----------
.../testutil/techprovider/SchemaProvider.java | 4 +-
8 files changed, 108 insertions(+), 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7c2dac9c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
index 00d853d..827824b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
@@ -74,8 +74,8 @@ public class ServiceDocumentJsonSerializer {
}
}
- private void writeFunctionImports(final JsonGenerator gen, final Edm edm) throws JsonGenerationException,
- IOException {
+ private void writeFunctionImports(final JsonGenerator gen, final Edm edm) throws JsonGenerationException,
+ IOException {
EdmEntityContainer container = edm.getEntityContainer(null);
for (EdmFunctionImport edmFunctionImport : container.getFunctionImports()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7c2dac9c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
index 2313a3a..d83ad86 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
@@ -160,7 +160,7 @@ public class MetadataDocumentXmlSerializer {
writer.writeEndElement();
}
- private void appendTypeDefinitions(XMLStreamWriter writer, List<EdmTypeDefinition> typeDefinitions)
+ private void appendTypeDefinitions(final XMLStreamWriter writer, final List<EdmTypeDefinition> typeDefinitions)
throws XMLStreamException {
for (EdmTypeDefinition definition : typeDefinitions) {
writer.writeEmptyElement(XML_TYPE_DEFINITION);
@@ -251,7 +251,7 @@ public class MetadataDocumentXmlSerializer {
}
- private void appendNavigationPropertyBindings(final XMLStreamWriter writer, EdmBindingTarget bindingTarget)
+ private void appendNavigationPropertyBindings(final XMLStreamWriter writer, final EdmBindingTarget bindingTarget)
throws XMLStreamException {
if (bindingTarget.getNavigationPropertyBindings() != null) {
for (EdmNavigationPropertyBinding binding : bindingTarget.getNavigationPropertyBindings()) {
@@ -292,7 +292,7 @@ public class MetadataDocumentXmlSerializer {
}
}
- private void appendOperationReturnType(final XMLStreamWriter writer, EdmOperation operation)
+ private void appendOperationReturnType(final XMLStreamWriter writer, final EdmOperation operation)
throws XMLStreamException {
EdmReturnType returnType = operation.getReturnType();
if (returnType != null) {
@@ -303,7 +303,7 @@ public class MetadataDocumentXmlSerializer {
}
}
- private void appendOperationParameters(final XMLStreamWriter writer, EdmOperation operation)
+ private void appendOperationParameters(final XMLStreamWriter writer, final EdmOperation operation)
throws XMLStreamException {
for (String parameterName : operation.getParameterNames()) {
EdmParameter parameter = operation.getParameter(parameterName);
@@ -329,7 +329,8 @@ public class MetadataDocumentXmlSerializer {
}
}
- private void appendReturnTypeFacets(XMLStreamWriter writer, EdmReturnType returnType) throws XMLStreamException {
+ private void appendReturnTypeFacets(final XMLStreamWriter writer, final EdmReturnType returnType)
+ throws XMLStreamException {
if (returnType.isNullable() != null) {
writer.writeAttribute(XML_NULLABLE, "" + returnType.isNullable());
}
@@ -344,7 +345,8 @@ public class MetadataDocumentXmlSerializer {
}
}
- private void appendParameterFacets(XMLStreamWriter writer, EdmParameter parameter) throws XMLStreamException {
+ private void appendParameterFacets(final XMLStreamWriter writer, final EdmParameter parameter)
+ throws XMLStreamException {
if (parameter.isNullable() != null) {
writer.writeAttribute(XML_NULLABLE, "" + parameter.isNullable());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7c2dac9c/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
index ebdcbe3..957721a 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
@@ -50,8 +50,8 @@ public class UriContext {
* #visitExpandPathExtension(final
* ExpandPathExtensionContext ctx)} to allow nodes
* deeper in the expand tree at
- * {@link #visitExpandPathExtension(
- * org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext ctx)}
+ * {@link
+ * #visitExpandPathExtension(org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext ctx)}
* appending path
* segments to the currently processed {@link ExpandItemImpl}.
*/
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7c2dac9c/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
index 88f84ec..9d08914 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
@@ -52,7 +52,6 @@ public class MetadataDocumentTest {
ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML);
EdmProviderImpl edm = new EdmProviderImpl(new EdmTechProvider());
InputStream metadata = serializer.metadataDocument(edm);
- String metadataString = StringUtils.inputStreamToString(metadata, false);
- //System.out.println(metadataString);
+ StringUtils.inputStreamToString(metadata, false);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7c2dac9c/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
index ef3cb19..f1748a7 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
@@ -55,7 +55,7 @@ public class ActionProvider {
public static final FullQualifiedName nameUARTETParam =
new FullQualifiedName(SchemaProvider.nameSpace, "UARTETParam");
-
+
public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(SchemaProvider.nameSpace,
"UARTPrimParam");
public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(SchemaProvider.nameSpace,
@@ -124,7 +124,7 @@ public class ActionProvider {
new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
.setParameters(Arrays.asList(
new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setNullable(false)))
+ .setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
@@ -132,7 +132,7 @@ public class ActionProvider {
new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
.setParameters(Arrays.asList(
new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav)
- .setNullable(false)))
+ .setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
@@ -167,7 +167,7 @@ public class ActionProvider {
new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
.setParameters(Arrays.asList(
new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .setNullable(false)))
+ .setNullable(false)))
.setBound(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7c2dac9c/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
index 2fcbec2..2db6d0e 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
@@ -93,7 +93,7 @@ public class ComplexTypeProvider {
} else if (complexTypeName.equals(nameCTCompNav)) {
return new ComplexType()
.setName("CTCompNav")
- .setProperties(Arrays.asList(PropertyProvider.propertyString,
+ .setProperties(Arrays.asList(PropertyProvider.propertyString,
PropertyProvider.propertyComplex_CTNavFiveProp));
} else if (complexTypeName.equals(nameCTMixPrimCollComp)) {
@@ -115,11 +115,7 @@ public class ComplexTypeProvider {
} else if (complexTypeName.equals(nameCTTwoBase)) {
return new ComplexType()
.setName("CTTwoBase")
- .setBaseType(nameCTBase)
- .setProperties(Arrays.asList(
- new Property()
- .setName("AdditionalPropString2")
- .setType(new FullQualifiedName("Edm", "String"))));
+ .setBaseType(nameCTBase);
} else if (complexTypeName.equals(nameCTCompComp)) {
return new ComplexType()
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7c2dac9c/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
index 6dc2399..2b6e10e 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
@@ -54,23 +54,23 @@ public class PropertyProvider {
.setName("CollPropertyBinary")
.setType(nameBinary)
.setCollection(true);
-
+
public static final Property collPropertyBinary_ExplicitNullable = new Property()
- .setName("CollPropertyBinary")
- .setType(nameBinary)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyBinary")
+ .setType(nameBinary)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyBoolean = new Property()
.setName("CollPropertyBoolean")
.setType(nameBoolean)
.setCollection(true);
-
+
public static final Property collPropertyBoolean_ExplicitNullable = new Property()
- .setName("CollPropertyBoolean")
- .setType(nameBoolean)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyBoolean")
+ .setType(nameBoolean)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyByte = new Property()
.setName("CollPropertyByte")
@@ -78,109 +78,109 @@ public class PropertyProvider {
.setCollection(true);
public static final Property collPropertyByte_ExplicitNullable = new Property()
- .setName("CollPropertyByte")
- .setType(nameByte)
- .setNullable(true)
- .setCollection(true);
-
+ .setName("CollPropertyByte")
+ .setType(nameByte)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyDate = new Property()
.setName("CollPropertyDate")
.setType(nameDate)
.setCollection(true);
-
+
public static final Property collPropertyDate_ExplicitNullable = new Property()
- .setName("CollPropertyDate")
- .setType(nameDate)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyDate")
+ .setType(nameDate)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyDateTimeOffset = new Property()
.setName("CollPropertyDateTimeOffset")
.setType(nameDateTimeOffset)
.setCollection(true);
-
+
public static final Property collPropertyDateTimeOffset_ExplicitNullable = new Property()
- .setName("CollPropertyDateTimeOffset")
- .setType(nameDateTimeOffset)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyDecimal = new Property()
.setName("CollPropertyDecimal")
.setType(nameDecimal)
.setCollection(true);
-
+
public static final Property collPropertyDecimal_ExplicitNullable = new Property()
- .setName("CollPropertyDecimal")
- .setType(nameDecimal)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyDecimal")
+ .setType(nameDecimal)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyDouble = new Property()
.setName("CollPropertyDouble")
.setType(nameDouble)
.setCollection(true);
-
+
public static final Property collPropertyDouble_ExplicitNullable = new Property()
- .setName("CollPropertyDouble")
- .setType(nameDouble)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyDouble")
+ .setType(nameDouble)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyDuration = new Property()
.setName("CollPropertyDuration")
.setType(nameDuration)
.setCollection(true);
-
+
public static final Property collPropertyDuration_ExplicitNullable = new Property()
- .setName("CollPropertyDuration")
- .setType(nameDuration)
- .setNullable(true)
- .setCollection(true);
-
+ .setName("CollPropertyDuration")
+ .setType(nameDuration)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyGuid = new Property()
.setName("CollPropertyGuid")
.setType(nameGuid)
.setCollection(true);
-
+
public static final Property collPropertyGuid_ExplicitNullable = new Property()
- .setName("CollPropertyGuid")
- .setType(nameGuid)
- .setNullable(true)
- .setCollection(true);
-
+ .setName("CollPropertyGuid")
+ .setType(nameGuid)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyInt16 = new Property()
.setName("CollPropertyInt16")
.setType(nameInt16)
.setCollection(true);
-
+
public static final Property collPropertyInt16_ExplicitNullable = new Property()
- .setName("CollPropertyInt16")
- .setType(nameInt16)
- .setNullable(true)
- .setCollection(true);
-
+ .setName("CollPropertyInt16")
+ .setType(nameInt16)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyInt32 = new Property()
.setName("CollPropertyInt32")
.setType(nameInt32)
.setCollection(true);
-
+
public static final Property collPropertyInt32_ExplicitNullable = new Property()
- .setName("CollPropertyInt32")
- .setType(nameInt32)
- .setNullable(true)
- .setCollection(true);
-
+ .setName("CollPropertyInt32")
+ .setType(nameInt32)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyInt64 = new Property()
.setName("CollPropertyInt64")
.setType(nameInt64)
.setCollection(true);
-
+
public static final Property collPropertyInt64_ExplicitNullable = new Property()
- .setName("CollPropertyInt64")
- .setType(nameInt64)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyInt64")
+ .setType(nameInt64)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertySByte = new Property()
.setName("CollPropertySByte")
@@ -188,43 +188,43 @@ public class PropertyProvider {
.setCollection(true);
public static final Property collPropertySByte_ExplicitNullable = new Property()
- .setName("CollPropertySByte")
- .setType(nameSByte)
- .setNullable(true)
- .setCollection(true);
-
+ .setName("CollPropertySByte")
+ .setType(nameSByte)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertySingle = new Property()
.setName("CollPropertySingle")
.setType(nameSingle)
.setCollection(true);
-
+
public static final Property collPropertySingle_ExplicitNullable = new Property()
- .setName("CollPropertySingle")
- .setType(nameSingle)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertySingle")
+ .setType(nameSingle)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyString = new Property()
.setName("CollPropertyString")
.setType(nameString)
.setCollection(true);
-
+
public static final Property collPropertyString_ExplicitNullable = new Property()
- .setName("CollPropertyString")
- .setType(nameString)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyString")
+ .setType(nameString)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyTimeOfDay = new Property()
- .setName("CollPropertyTimeOfDay")
- .setType(nameTimeOfDay)
- .setCollection(true);
-
+ .setName("CollPropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setCollection(true);
+
public static final Property collPropertyTimeOfDay_ExplicitNullable = new Property()
- .setName("CollPropertyTimeOfDay")
- .setType(nameTimeOfDay)
- .setNullable(true)
- .setCollection(true);
+ .setName("CollPropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setNullable(true)
+ .setCollection(true);
public static final Property propertyBinary = new Property()
.setName("PropertyBinary")
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7c2dac9c/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java
index 81f638d..70d9987 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java
@@ -166,11 +166,11 @@ public class SchemaProvider {
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCTNavFiveProp));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCollCTNavFiveProp));
-
+
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTStringParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTETKeyNavParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTETTwoKeyNavParam));
- //functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNavParam));
+ // functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNavParam));
// EntityContainer
EntityContainer container = new EntityContainer();
[50/51] [abbrv] git commit: [OLINGO-209] open type is both for
complex and entity types
Posted by sk...@apache.org.
[OLINGO-209] open type is both for complex and entity types
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/25174231
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/25174231
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/25174231
Branch: refs/heads/olingo-206-validator
Commit: 251742312ac73f23b675e07cb7bf34a8cbbb87eb
Parents: a6817f3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Apr 3 11:12:22 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Apr 3 11:12:22 2014 +0200
----------------------------------------------------------------------
.../olingo/client/core/edm/EdmClientImpl.java | 4 +-
.../client/core/edm/EdmComplexTypeImpl.java | 5 +
.../client/core/edm/EdmEntityTypeImpl.java | 5 +-
.../olingo/client/core/edm/EdmSchemaImpl.java | 4 +-
.../core/edm/EdmStructuredTypeHelperImpl.java | 11 +
.../olingo/commons/api/edm/EdmEntityType.java | 7 -
.../commons/api/edm/EdmStructuredType.java | 7 +
.../olingo/commons/core/edm/AbstractEdm.java | 333 +++++++++++++++++++
.../commons/core/edm/AbstractEdmImpl.java | 333 -------------------
.../commons/core/edm/AbstractEdmSchema.java | 154 +++++++++
.../commons/core/edm/AbstractEdmSchemaImpl.java | 154 ---------
.../core/edm/AbstractEdmStructuredType.java | 16 +-
.../core/edm/EdmStructuredTypeHelper.java | 3 +
.../commons/core/edm/EdmImplCachingTest.java | 4 +-
.../commons/core/edm/EdmImplCallCreateTest.java | 4 +-
.../core/edm/provider/EdmComplexTypeImpl.java | 7 +-
.../core/edm/provider/EdmEntityTypeImpl.java | 2 +-
.../core/edm/provider/EdmProviderImpl.java | 4 +-
.../server/core/edm/provider/EdmSchemaImpl.java | 4 +-
.../provider/EdmStructuredTypeHelperImpl.java | 8 +-
20 files changed, 550 insertions(+), 519 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index c2c832d..0fe9ce6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -57,9 +57,9 @@ import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
-public class EdmClientImpl extends AbstractEdmImpl {
+public class EdmClientImpl extends AbstractEdm {
private final ODataServiceVersion version;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
index 9ecc511..caaf7c0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
@@ -64,4 +64,9 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
return helper.getNavigationProperties();
}
+ @Override
+ public boolean isOpenType() {
+ return helper.isOpenType();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
index 0f9d0e6..994e42c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
@@ -61,14 +61,11 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
return instance;
}
- private final EntityType entityType;
-
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
final EntityType entityType) {
super(edm, fqn, baseTypeName, entityType.isHasStream());
this.helper = new EdmStructuredTypeHelperImpl(edm, entityType);
- this.entityType = entityType;
}
@Override
@@ -83,7 +80,7 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
@Override
public boolean isOpenType() {
- return entityType.isOpenType();
+ return helper.isOpenType();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
index 7d8e1ae..0d5a936 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
@@ -43,9 +43,9 @@ import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
-public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
+public class EdmSchemaImpl extends AbstractEdmSchema {
private final ODataServiceVersion version;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java
index 140fe89..f3b8946 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java
@@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
import org.apache.olingo.client.api.edm.xml.CommonProperty;
import org.apache.olingo.client.api.edm.xml.ComplexType;
+import org.apache.olingo.client.api.edm.xml.EntityType;
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
@@ -69,4 +70,14 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
}
return navigationProperties;
}
+
+ @Override
+ public boolean isOpenType() {
+ return complexType instanceof org.apache.olingo.client.api.edm.xml.v4.ComplexType
+ ? ((org.apache.olingo.client.api.edm.xml.v4.ComplexType) complexType).isOpenType()
+ : complexType instanceof EntityType
+ ? ((EntityType) complexType).isOpenType()
+ : false;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
index fe698c4..9eb0dd5 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
@@ -54,13 +54,6 @@ public interface EdmEntityType extends EdmStructuredType {
*/
boolean hasStream();
- /**
- * Indicates if the entity type is an open type.
- *
- * @return <code>true</code> if the entity type is open
- */
- boolean isOpenType();
-
/*
* (non-Javadoc)
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
index 3c823dc..6990091 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
@@ -79,4 +79,11 @@ public interface EdmStructuredType extends EdmType {
* @return true if this type is compatible to the testType ( i.e. this type is a subtype of targetType )
*/
boolean compatibleTo(EdmType targetType);
+
+ /**
+ * Indicates if the entity type is an open type.
+ *
+ * @return <code>true</code> if the entity type is open
+ */
+ boolean isOpenType();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
new file mode 100644
index 0000000..5047192
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
@@ -0,0 +1,333 @@
+/*
+ * 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.commons.core.edm;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+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.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdm implements Edm {
+
+ private final Map<FullQualifiedName, EdmEntityContainer> entityContainers =
+ new HashMap<FullQualifiedName, EdmEntityContainer>();
+
+ private final Map<FullQualifiedName, EdmEnumType> enumTypes = new HashMap<FullQualifiedName, EdmEnumType>();
+
+ private final Map<FullQualifiedName, EdmTypeDefinition> typeDefinitions =
+ new HashMap<FullQualifiedName, EdmTypeDefinition>();
+
+ private final Map<FullQualifiedName, EdmEntityType> entityTypes = new HashMap<FullQualifiedName, EdmEntityType>();
+
+ private final Map<FullQualifiedName, EdmComplexType> complexTypes = new HashMap<FullQualifiedName, EdmComplexType>();
+
+ private final Map<FullQualifiedName, EdmAction> unboundActions = new HashMap<FullQualifiedName, EdmAction>();
+
+ private final Map<FunctionMapKey, EdmFunction> unboundFunctions = new HashMap<FunctionMapKey, EdmFunction>();
+
+ private final Map<ActionMapKey, EdmAction> boundActions = new HashMap<ActionMapKey, EdmAction>();
+
+ private final Map<FunctionMapKey, EdmFunction> boundFunctions = new HashMap<FunctionMapKey, EdmFunction>();
+
+ private EdmServiceMetadata serviceMetadata;
+
+ private Map<String, String> aliasToNamespaceInfo;
+
+ private List<EdmSchema> schemas;
+
+ @Override
+ public List<EdmSchema> getSchemas() {
+ if (schemas == null) {
+ schemas = createSchemas();
+ if (schemas != null) {
+ aliasToNamespaceInfo = new HashMap<String, String>();
+ for (EdmSchema schema : schemas) {
+ String namespace = schema.getNamespace();
+ if (schema.getAlias() != null) {
+ aliasToNamespaceInfo.put(schema.getAlias(), namespace);
+ }
+
+ List<EdmEnumType> localEnumTypes = schema.getEnumTypes();
+ if (localEnumTypes != null) {
+ for (EdmEnumType enumType : localEnumTypes) {
+ enumTypes.put(new FullQualifiedName(namespace, enumType.getName()), enumType);
+ }
+ }
+
+ List<EdmTypeDefinition> localTypeDefinitions = schema.getTypeDefinitions();
+ if (localTypeDefinitions != null) {
+ for (EdmTypeDefinition typeDef : localTypeDefinitions) {
+ typeDefinitions.put(new FullQualifiedName(namespace, typeDef.getName()), typeDef);
+ }
+ }
+
+ List<EdmComplexType> localComplexTypes = schema.getComplexTypes();
+ if (localComplexTypes != null) {
+ for (EdmComplexType complexType : localComplexTypes) {
+ complexTypes.put(new FullQualifiedName(namespace, complexType.getName()), complexType);
+ }
+ }
+
+ List<EdmEntityType> localEntityTypes = schema.getEntityTypes();
+ if (localEntityTypes != null) {
+ for (EdmEntityType entityType : localEntityTypes) {
+ entityTypes.put(new FullQualifiedName(namespace, entityType.getName()), entityType);
+ }
+ }
+
+ List<EdmAction> localActions = schema.getActions();
+ if (localActions != null) {
+ for (EdmAction action : localActions) {
+ if (action.isBound()) {
+ ActionMapKey key = new ActionMapKey(new FullQualifiedName(namespace, action.getName()),
+ action.getBindingParameterTypeFqn(), action.isBindingParameterTypeCollection());
+ boundActions.put(key, action);
+ } else {
+ unboundActions.put(new FullQualifiedName(namespace, action.getName()), action);
+ }
+ }
+ }
+
+ List<EdmFunction> localFunctions = schema.getFunctions();
+ if (localFunctions != null) {
+ for (EdmFunction function : localFunctions) {
+ FunctionMapKey key =
+ new FunctionMapKey(new FullQualifiedName(namespace, function.getName()), function
+ .getBindingParameterTypeFqn(), function.isBindingParameterTypeCollection(), function
+ .getParameterNames());
+
+ if (function.isBound()) {
+ boundFunctions.put(key, function);
+ } else {
+ unboundFunctions.put(key, function);
+ }
+ }
+ }
+
+ EdmEntityContainer entityContainer = schema.getEntityContainer();
+ if(entityContainer != null){
+ entityContainers.put(new FullQualifiedName(namespace, entityContainer.getName()), entityContainer);
+ if(!entityContainers.containsKey(null)){
+ entityContainers.put(null, entityContainer);
+ }
+ }
+ }
+ }
+ }
+ return schemas;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer(final FullQualifiedName namespaceOrAliasFQN) {
+ final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmEntityContainer container = entityContainers.get(fqn);
+ if (container == null) {
+ container = createEntityContainer(fqn);
+ if (container != null) {
+ entityContainers.put(fqn, container);
+ if (fqn == null) {
+ entityContainers.put(new FullQualifiedName(container.getNamespace(), container.getName()), container);
+ }
+ }
+ }
+ return container;
+ }
+
+ @Override
+ public EdmEnumType getEnumType(final FullQualifiedName namespaceOrAliasFQN) {
+ final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmEnumType enumType = enumTypes.get(fqn);
+ if (enumType == null) {
+ enumType = createEnumType(fqn);
+ if (enumType != null) {
+ enumTypes.put(fqn, enumType);
+ }
+ }
+ return enumType;
+ }
+
+ @Override
+ public EdmTypeDefinition getTypeDefinition(final FullQualifiedName namespaceOrAliasFQN) {
+ final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmTypeDefinition typeDefinition = typeDefinitions.get(fqn);
+ if (typeDefinition == null) {
+ typeDefinition = createTypeDefinition(fqn);
+ if (typeDefinition != null) {
+ typeDefinitions.put(fqn, typeDefinition);
+ }
+ }
+ return typeDefinition;
+ }
+
+ @Override
+ public EdmEntityType getEntityType(final FullQualifiedName namespaceOrAliasFQN) {
+ final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmEntityType entityType = entityTypes.get(fqn);
+ if (entityType == null) {
+ entityType = createEntityType(fqn);
+ if (entityType != null) {
+ entityTypes.put(fqn, entityType);
+ }
+ }
+ return entityType;
+ }
+
+ @Override
+ public EdmComplexType getComplexType(final FullQualifiedName namespaceOrAliasFQN) {
+ final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmComplexType complexType = complexTypes.get(fqn);
+ if (complexType == null) {
+ complexType = createComplexType(fqn);
+ if (complexType != null) {
+ complexTypes.put(fqn, complexType);
+ }
+ }
+ return complexType;
+ }
+
+ @Override
+ public EdmAction getAction(final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName,
+ final Boolean isBindingParameterCollection) {
+
+ EdmAction action = null;
+
+ final FullQualifiedName actionFqn = resolvePossibleAlias(actionName);
+ if (bindingParameterTypeName == null) {
+ action = unboundActions.get(actionName);
+ if (action == null) {
+ action = createUnboundAction(actionFqn);
+ if (action != null) {
+ unboundActions.put(actionName, action);
+ }
+ }
+ } else {
+ final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
+ final ActionMapKey key = new ActionMapKey(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
+ action = boundActions.get(key);
+ if (action == null) {
+ action = createBoundAction(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
+ if (action != null) {
+ boundActions.put(key, action);
+ }
+ }
+ }
+
+ return action;
+ }
+
+ @Override
+ public EdmFunction getFunction(final FullQualifiedName functionName,
+ final FullQualifiedName bindingParameterTypeName,
+ final Boolean isBindingParameterCollection, final List<String> parameterNames) {
+
+ EdmFunction function = null;
+
+ final FullQualifiedName functionFqn = resolvePossibleAlias(functionName);
+ if (bindingParameterTypeName == null) {
+ final FunctionMapKey key = new FunctionMapKey(
+ functionFqn, bindingParameterTypeName, isBindingParameterCollection, parameterNames);
+ function = unboundFunctions.get(key);
+ if (function == null) {
+ function = createUnboundFunction(functionFqn, parameterNames);
+ if (function != null) {
+ unboundFunctions.put(key, function);
+ }
+ }
+ } else {
+ final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
+ final FunctionMapKey key =
+ new FunctionMapKey(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection, parameterNames);
+ function = boundFunctions.get(key);
+ if (function == null) {
+ function = createBoundFunction(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection,
+ parameterNames);
+ if (function != null) {
+ boundFunctions.put(key, function);
+ }
+ }
+ }
+
+ return function;
+ }
+
+ @Override
+ public EdmServiceMetadata getServiceMetadata() {
+ if (serviceMetadata == null) {
+ serviceMetadata = createServiceMetadata();
+ }
+ return serviceMetadata;
+ }
+
+ private FullQualifiedName resolvePossibleAlias(final FullQualifiedName namespaceOrAliasFQN) {
+ if (aliasToNamespaceInfo == null) {
+ aliasToNamespaceInfo = createAliasToNamespaceInfo();
+ }
+ FullQualifiedName finalFQN = null;
+ if (namespaceOrAliasFQN != null) {
+ final String namespace = aliasToNamespaceInfo.get(namespaceOrAliasFQN.getNamespace());
+ // If not contained in info it must be a namespace
+ if (namespace == null) {
+ finalFQN = namespaceOrAliasFQN;
+ } else {
+ finalFQN = new FullQualifiedName(namespace, namespaceOrAliasFQN.getName());
+ }
+ }
+ return finalFQN;
+ }
+
+ protected abstract Map<String, String> createAliasToNamespaceInfo();
+
+ protected abstract EdmEntityContainer createEntityContainer(FullQualifiedName containerName);
+
+ protected abstract EdmEnumType createEnumType(FullQualifiedName enumName);
+
+ protected abstract EdmTypeDefinition createTypeDefinition(FullQualifiedName typeDefinitionName);
+
+ protected abstract EdmEntityType createEntityType(FullQualifiedName entityTypeName);
+
+ protected abstract EdmComplexType createComplexType(FullQualifiedName complexTypeName);
+
+ protected abstract EdmAction createUnboundAction(FullQualifiedName actionName);
+
+ protected abstract EdmFunction createUnboundFunction(FullQualifiedName functionName, List<String> parameterNames);
+
+ protected abstract EdmAction createBoundAction(FullQualifiedName actionName,
+ FullQualifiedName bindingParameterTypeName,
+ Boolean isBindingParameterCollection);
+
+ protected abstract EdmFunction createBoundFunction(FullQualifiedName functionName,
+ FullQualifiedName bindingParameterTypeName, Boolean isBindingParameterCollection,
+ List<String> parameterNames);
+
+ protected abstract EdmServiceMetadata createServiceMetadata();
+
+ protected abstract List<EdmSchema> createSchemas();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
deleted file mode 100644
index b4c99d8..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
+++ /dev/null
@@ -1,333 +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.commons.core.edm;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-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.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public abstract class AbstractEdmImpl implements Edm {
-
- private final Map<FullQualifiedName, EdmEntityContainer> entityContainers =
- new HashMap<FullQualifiedName, EdmEntityContainer>();
-
- private final Map<FullQualifiedName, EdmEnumType> enumTypes = new HashMap<FullQualifiedName, EdmEnumType>();
-
- private final Map<FullQualifiedName, EdmTypeDefinition> typeDefinitions =
- new HashMap<FullQualifiedName, EdmTypeDefinition>();
-
- private final Map<FullQualifiedName, EdmEntityType> entityTypes = new HashMap<FullQualifiedName, EdmEntityType>();
-
- private final Map<FullQualifiedName, EdmComplexType> complexTypes = new HashMap<FullQualifiedName, EdmComplexType>();
-
- private final Map<FullQualifiedName, EdmAction> unboundActions = new HashMap<FullQualifiedName, EdmAction>();
-
- private final Map<FunctionMapKey, EdmFunction> unboundFunctions = new HashMap<FunctionMapKey, EdmFunction>();
-
- private final Map<ActionMapKey, EdmAction> boundActions = new HashMap<ActionMapKey, EdmAction>();
-
- private final Map<FunctionMapKey, EdmFunction> boundFunctions = new HashMap<FunctionMapKey, EdmFunction>();
-
- private EdmServiceMetadata serviceMetadata;
-
- private Map<String, String> aliasToNamespaceInfo;
-
- private List<EdmSchema> schemas;
-
- @Override
- public List<EdmSchema> getSchemas() {
- if (schemas == null) {
- schemas = createSchemas();
- if (schemas != null) {
- aliasToNamespaceInfo = new HashMap<String, String>();
- for (EdmSchema schema : schemas) {
- String namespace = schema.getNamespace();
- if (schema.getAlias() != null) {
- aliasToNamespaceInfo.put(schema.getAlias(), namespace);
- }
-
- List<EdmEnumType> localEnumTypes = schema.getEnumTypes();
- if (localEnumTypes != null) {
- for (EdmEnumType enumType : localEnumTypes) {
- enumTypes.put(new FullQualifiedName(namespace, enumType.getName()), enumType);
- }
- }
-
- List<EdmTypeDefinition> localTypeDefinitions = schema.getTypeDefinitions();
- if (localTypeDefinitions != null) {
- for (EdmTypeDefinition typeDef : localTypeDefinitions) {
- typeDefinitions.put(new FullQualifiedName(namespace, typeDef.getName()), typeDef);
- }
- }
-
- List<EdmComplexType> localComplexTypes = schema.getComplexTypes();
- if (localComplexTypes != null) {
- for (EdmComplexType complexType : localComplexTypes) {
- complexTypes.put(new FullQualifiedName(namespace, complexType.getName()), complexType);
- }
- }
-
- List<EdmEntityType> localEntityTypes = schema.getEntityTypes();
- if (localEntityTypes != null) {
- for (EdmEntityType entityType : localEntityTypes) {
- entityTypes.put(new FullQualifiedName(namespace, entityType.getName()), entityType);
- }
- }
-
- List<EdmAction> localActions = schema.getActions();
- if (localActions != null) {
- for (EdmAction action : localActions) {
- if (action.isBound()) {
- ActionMapKey key = new ActionMapKey(new FullQualifiedName(namespace, action.getName()),
- action.getBindingParameterTypeFqn(), action.isBindingParameterTypeCollection());
- boundActions.put(key, action);
- } else {
- unboundActions.put(new FullQualifiedName(namespace, action.getName()), action);
- }
- }
- }
-
- List<EdmFunction> localFunctions = schema.getFunctions();
- if (localFunctions != null) {
- for (EdmFunction function : localFunctions) {
- FunctionMapKey key =
- new FunctionMapKey(new FullQualifiedName(namespace, function.getName()), function
- .getBindingParameterTypeFqn(), function.isBindingParameterTypeCollection(), function
- .getParameterNames());
-
- if (function.isBound()) {
- boundFunctions.put(key, function);
- } else {
- unboundFunctions.put(key, function);
- }
- }
- }
-
- EdmEntityContainer entityContainer = schema.getEntityContainer();
- if(entityContainer != null){
- entityContainers.put(new FullQualifiedName(namespace, entityContainer.getName()), entityContainer);
- if(!entityContainers.containsKey(null)){
- entityContainers.put(null, entityContainer);
- }
- }
- }
- }
- }
- return schemas;
- }
-
- @Override
- public EdmEntityContainer getEntityContainer(final FullQualifiedName namespaceOrAliasFQN) {
- final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
- EdmEntityContainer container = entityContainers.get(fqn);
- if (container == null) {
- container = createEntityContainer(fqn);
- if (container != null) {
- entityContainers.put(fqn, container);
- if (fqn == null) {
- entityContainers.put(new FullQualifiedName(container.getNamespace(), container.getName()), container);
- }
- }
- }
- return container;
- }
-
- @Override
- public EdmEnumType getEnumType(final FullQualifiedName namespaceOrAliasFQN) {
- final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
- EdmEnumType enumType = enumTypes.get(fqn);
- if (enumType == null) {
- enumType = createEnumType(fqn);
- if (enumType != null) {
- enumTypes.put(fqn, enumType);
- }
- }
- return enumType;
- }
-
- @Override
- public EdmTypeDefinition getTypeDefinition(final FullQualifiedName namespaceOrAliasFQN) {
- final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
- EdmTypeDefinition typeDefinition = typeDefinitions.get(fqn);
- if (typeDefinition == null) {
- typeDefinition = createTypeDefinition(fqn);
- if (typeDefinition != null) {
- typeDefinitions.put(fqn, typeDefinition);
- }
- }
- return typeDefinition;
- }
-
- @Override
- public EdmEntityType getEntityType(final FullQualifiedName namespaceOrAliasFQN) {
- final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
- EdmEntityType entityType = entityTypes.get(fqn);
- if (entityType == null) {
- entityType = createEntityType(fqn);
- if (entityType != null) {
- entityTypes.put(fqn, entityType);
- }
- }
- return entityType;
- }
-
- @Override
- public EdmComplexType getComplexType(final FullQualifiedName namespaceOrAliasFQN) {
- final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
- EdmComplexType complexType = complexTypes.get(fqn);
- if (complexType == null) {
- complexType = createComplexType(fqn);
- if (complexType != null) {
- complexTypes.put(fqn, complexType);
- }
- }
- return complexType;
- }
-
- @Override
- public EdmAction getAction(final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName,
- final Boolean isBindingParameterCollection) {
-
- EdmAction action = null;
-
- final FullQualifiedName actionFqn = resolvePossibleAlias(actionName);
- if (bindingParameterTypeName == null) {
- action = unboundActions.get(actionName);
- if (action == null) {
- action = createUnboundAction(actionFqn);
- if (action != null) {
- unboundActions.put(actionName, action);
- }
- }
- } else {
- final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
- final ActionMapKey key = new ActionMapKey(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
- action = boundActions.get(key);
- if (action == null) {
- action = createBoundAction(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
- if (action != null) {
- boundActions.put(key, action);
- }
- }
- }
-
- return action;
- }
-
- @Override
- public EdmFunction getFunction(final FullQualifiedName functionName,
- final FullQualifiedName bindingParameterTypeName,
- final Boolean isBindingParameterCollection, final List<String> parameterNames) {
-
- EdmFunction function = null;
-
- final FullQualifiedName functionFqn = resolvePossibleAlias(functionName);
- if (bindingParameterTypeName == null) {
- final FunctionMapKey key = new FunctionMapKey(
- functionFqn, bindingParameterTypeName, isBindingParameterCollection, parameterNames);
- function = unboundFunctions.get(key);
- if (function == null) {
- function = createUnboundFunction(functionFqn, parameterNames);
- if (function != null) {
- unboundFunctions.put(key, function);
- }
- }
- } else {
- final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
- final FunctionMapKey key =
- new FunctionMapKey(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection, parameterNames);
- function = boundFunctions.get(key);
- if (function == null) {
- function = createBoundFunction(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection,
- parameterNames);
- if (function != null) {
- boundFunctions.put(key, function);
- }
- }
- }
-
- return function;
- }
-
- @Override
- public EdmServiceMetadata getServiceMetadata() {
- if (serviceMetadata == null) {
- serviceMetadata = createServiceMetadata();
- }
- return serviceMetadata;
- }
-
- private FullQualifiedName resolvePossibleAlias(final FullQualifiedName namespaceOrAliasFQN) {
- if (aliasToNamespaceInfo == null) {
- aliasToNamespaceInfo = createAliasToNamespaceInfo();
- }
- FullQualifiedName finalFQN = null;
- if (namespaceOrAliasFQN != null) {
- final String namespace = aliasToNamespaceInfo.get(namespaceOrAliasFQN.getNamespace());
- // If not contained in info it must be a namespace
- if (namespace == null) {
- finalFQN = namespaceOrAliasFQN;
- } else {
- finalFQN = new FullQualifiedName(namespace, namespaceOrAliasFQN.getName());
- }
- }
- return finalFQN;
- }
-
- protected abstract Map<String, String> createAliasToNamespaceInfo();
-
- protected abstract EdmEntityContainer createEntityContainer(FullQualifiedName containerName);
-
- protected abstract EdmEnumType createEnumType(FullQualifiedName enumName);
-
- protected abstract EdmTypeDefinition createTypeDefinition(FullQualifiedName typeDefinitionName);
-
- protected abstract EdmEntityType createEntityType(FullQualifiedName entityTypeName);
-
- protected abstract EdmComplexType createComplexType(FullQualifiedName complexTypeName);
-
- protected abstract EdmAction createUnboundAction(FullQualifiedName actionName);
-
- protected abstract EdmFunction createUnboundFunction(FullQualifiedName functionName, List<String> parameterNames);
-
- protected abstract EdmAction createBoundAction(FullQualifiedName actionName,
- FullQualifiedName bindingParameterTypeName,
- Boolean isBindingParameterCollection);
-
- protected abstract EdmFunction createBoundFunction(FullQualifiedName functionName,
- FullQualifiedName bindingParameterTypeName, Boolean isBindingParameterCollection,
- List<String> parameterNames);
-
- protected abstract EdmServiceMetadata createServiceMetadata();
-
- protected abstract List<EdmSchema> createSchemas();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java
new file mode 100644
index 0000000..64bd3b9
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java
@@ -0,0 +1,154 @@
+/*
+ * 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.commons.core.edm;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+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.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdmSchema implements EdmSchema {
+
+ protected final String namespace;
+
+ private final String alias;
+
+ private List<EdmTypeDefinition> typeDefinitions;
+
+ private List<EdmEnumType> enumTypes;
+
+ private List<EdmEntityType> entityTypes;
+
+ private List<EdmComplexType> complexTypes;
+
+ private List<EdmAction> actions;
+
+ private List<EdmFunction> functions;
+
+ private EdmEntityContainer entityContainer;
+
+ public AbstractEdmSchema(String namespace, String alias) {
+ this.namespace = namespace;
+ this.alias = alias;
+ }
+
+ protected abstract EdmEntityContainer createEntityContainer();
+
+ protected abstract List<EdmTypeDefinition> createTypeDefinitions();
+
+ protected abstract List<EdmEnumType> createEnumTypes();
+
+ protected abstract List<EdmEntityType> createEntityTypes();
+
+ protected abstract List<EdmComplexType> createComplexTypes();
+
+ protected abstract List<EdmAction> createActions();
+
+ protected abstract List<EdmFunction> createFunctions();
+
+ @Override
+ public List<EdmTypeDefinition> getTypeDefinitions() {
+ if (typeDefinitions == null) {
+ typeDefinitions = createTypeDefinitions();
+ }
+ return typeDefinitions;
+ }
+
+ @Override
+ public List<EdmEnumType> getEnumTypes() {
+ if (enumTypes == null) {
+ enumTypes = createEnumTypes();
+ }
+ return enumTypes;
+ }
+
+ @Override
+ public List<EdmEntityType> getEntityTypes() {
+ if (entityTypes == null) {
+ entityTypes = createEntityTypes();
+ }
+ return entityTypes;
+ }
+
+ @Override
+ public List<EdmComplexType> getComplexTypes() {
+ if (complexTypes == null) {
+ complexTypes = createComplexTypes();
+ }
+ return complexTypes;
+ }
+
+ @Override
+ public List<EdmAction> getActions() {
+ if (actions == null) {
+ actions = createActions();
+ }
+ return actions;
+ }
+
+ @Override
+ public List<EdmFunction> getFunctions() {
+ if (functions == null) {
+ functions = createFunctions();
+ }
+ return functions;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() {
+ if (entityContainer == null) {
+ entityContainer = createEntityContainer();
+ }
+ return entityContainer;
+ }
+
+ @Override
+ public List<EdmEntityContainer> getEntityContainers() {
+ return Collections.singletonList(getEntityContainer());
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
+ return getEntityContainer() == null
+ ? null
+ : name == null
+ ? getEntityContainer()
+ : name.equals(new FullQualifiedName(getEntityContainer().getNamespace(), getEntityContainer().getName()))
+ ? getEntityContainer()
+ : null;
+ }
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public String getAlias() {
+ return alias;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
deleted file mode 100644
index 20f7c92..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
+++ /dev/null
@@ -1,154 +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.commons.core.edm;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-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.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public abstract class AbstractEdmSchemaImpl implements EdmSchema {
-
- protected final String namespace;
-
- private final String alias;
-
- private List<EdmTypeDefinition> typeDefinitions;
-
- private List<EdmEnumType> enumTypes;
-
- private List<EdmEntityType> entityTypes;
-
- private List<EdmComplexType> complexTypes;
-
- private List<EdmAction> actions;
-
- private List<EdmFunction> functions;
-
- private EdmEntityContainer entityContainer;
-
- public AbstractEdmSchemaImpl(String namespace, String alias) {
- this.namespace = namespace;
- this.alias = alias;
- }
-
- protected abstract EdmEntityContainer createEntityContainer();
-
- protected abstract List<EdmTypeDefinition> createTypeDefinitions();
-
- protected abstract List<EdmEnumType> createEnumTypes();
-
- protected abstract List<EdmEntityType> createEntityTypes();
-
- protected abstract List<EdmComplexType> createComplexTypes();
-
- protected abstract List<EdmAction> createActions();
-
- protected abstract List<EdmFunction> createFunctions();
-
- @Override
- public List<EdmTypeDefinition> getTypeDefinitions() {
- if (typeDefinitions == null) {
- typeDefinitions = createTypeDefinitions();
- }
- return typeDefinitions;
- }
-
- @Override
- public List<EdmEnumType> getEnumTypes() {
- if (enumTypes == null) {
- enumTypes = createEnumTypes();
- }
- return enumTypes;
- }
-
- @Override
- public List<EdmEntityType> getEntityTypes() {
- if (entityTypes == null) {
- entityTypes = createEntityTypes();
- }
- return entityTypes;
- }
-
- @Override
- public List<EdmComplexType> getComplexTypes() {
- if (complexTypes == null) {
- complexTypes = createComplexTypes();
- }
- return complexTypes;
- }
-
- @Override
- public List<EdmAction> getActions() {
- if (actions == null) {
- actions = createActions();
- }
- return actions;
- }
-
- @Override
- public List<EdmFunction> getFunctions() {
- if (functions == null) {
- functions = createFunctions();
- }
- return functions;
- }
-
- @Override
- public EdmEntityContainer getEntityContainer() {
- if (entityContainer == null) {
- entityContainer = createEntityContainer();
- }
- return entityContainer;
- }
-
- @Override
- public List<EdmEntityContainer> getEntityContainers() {
- return Collections.singletonList(getEntityContainer());
- }
-
- @Override
- public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
- return getEntityContainer() == null
- ? null
- : name == null
- ? getEntityContainer()
- : name.equals(new FullQualifiedName(getEntityContainer().getNamespace(), getEntityContainer().getName()))
- ? getEntityContainer()
- : null;
- }
-
- @Override
- public String getNamespace() {
- return namespace;
- }
-
- @Override
- public String getAlias() {
- return alias;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
index a4cd47d..af4f2dd 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
@@ -35,15 +35,18 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
protected EdmStructuredType baseType;
+
protected FullQualifiedName baseTypeName;
+
private List<String> propertyNames;
+
private List<String> navigationPropertyNames;
public AbstractEdmStructuredType(
- final Edm edm,
- final FullQualifiedName typeName,
- final EdmTypeKind kind,
- final FullQualifiedName baseTypeName) {
+ final Edm edm,
+ final FullQualifiedName typeName,
+ final EdmTypeKind kind,
+ final FullQualifiedName baseTypeName) {
super(edm, typeName, kind);
this.baseTypeName = baseTypeName;
@@ -54,7 +57,7 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
protected abstract Map<String, EdmProperty> getProperties();
protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
-
+
protected abstract void checkBaseType();
@Override
@@ -125,7 +128,7 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
throw new EdmException("Target type must not be null");
}
while (!sourceType.getName().equals(targetType.getName())
- || !sourceType.getNamespace().equals(targetType.getNamespace())) {
+ || !sourceType.getNamespace().equals(targetType.getNamespace())) {
sourceType = sourceType.getBaseType();
if (sourceType == null) {
@@ -135,4 +138,5 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
return true;
}
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java
index e1226dd..a14700b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java
@@ -28,4 +28,7 @@ public interface EdmStructuredTypeHelper {
Map<String, EdmProperty> getProperties();
Map<String, EdmNavigationProperty> getNavigationProperties();
+
+ boolean isOpenType();
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
index 4eba1db..474a58d 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
@@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
import org.junit.Before;
import org.junit.Test;
@@ -260,7 +260,7 @@ public class EdmImplCachingTest {
edm = new LocalEdm();
}
- private class LocalEdm extends AbstractEdmImpl {
+ private class LocalEdm extends AbstractEdm {
@Override
public EdmEntityContainer createEntityContainer(final FullQualifiedName fqn) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java
index 71e1acd..52d47e2 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java
@@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
import org.junit.Before;
import org.junit.Test;
@@ -158,7 +158,7 @@ public class EdmImplCallCreateTest {
edm = new LocalEdm();
}
- private class LocalEdm extends AbstractEdmImpl {
+ private class LocalEdm extends AbstractEdm {
@Override
public EdmEntityContainer createEntityContainer(final FullQualifiedName fqn) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
index 34df670..91bec42 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
@@ -33,7 +33,7 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
private final EdmStructuredTypeHelper helper;
public static EdmComplexTypeImpl getInstance(
- final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
+ final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
final EdmComplexTypeImpl instance = new EdmComplexTypeImpl(edm, name, complexType);
return instance;
@@ -54,4 +54,9 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
return helper.getNavigationProperties();
}
+ @Override
+ public boolean isOpenType() {
+ return helper.isOpenType();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
index c6360d8..b6c7828 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
@@ -90,7 +90,7 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
@Override
public boolean isOpenType() {
- return entityType.isOpenType();
+ return helper.isOpenType();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
index e4cf9b2..d35d55d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
@@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
import org.apache.olingo.server.api.edm.provider.Action;
import org.apache.olingo.server.api.edm.provider.AliasInfo;
import org.apache.olingo.server.api.edm.provider.ComplexType;
@@ -49,7 +49,7 @@ import org.apache.olingo.server.api.edm.provider.Parameter;
import org.apache.olingo.server.api.edm.provider.Schema;
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-public class EdmProviderImpl extends AbstractEdmImpl {
+public class EdmProviderImpl extends AbstractEdm {
private final EdmProvider provider;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
index 34d34b4..f95338e 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
@@ -30,7 +30,7 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
import org.apache.olingo.server.api.edm.provider.Action;
import org.apache.olingo.server.api.edm.provider.ComplexType;
import org.apache.olingo.server.api.edm.provider.EdmProvider;
@@ -40,7 +40,7 @@ import org.apache.olingo.server.api.edm.provider.Function;
import org.apache.olingo.server.api.edm.provider.Schema;
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
+public class EdmSchemaImpl extends AbstractEdmSchema {
private final Schema schema;
private final Edm edm;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
index cc12769..4fdda9c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
@@ -64,10 +64,16 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
if (structuredType.getNavigationProperties() != null) {
for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
navigationProperties.put(navigationProperty.getName(),
- new EdmNavigationPropertyImpl(edm, navigationProperty));
+ new EdmNavigationPropertyImpl(edm, navigationProperty));
}
}
}
return navigationProperties;
}
+
+ @Override
+ public boolean isOpenType() {
+ return structuredType.isOpenType();
+ }
+
}
[36/51] [abbrv] git commit: fixes OLINGO-227
Posted by sk...@apache.org.
fixes OLINGO-227
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/b275fc40
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/b275fc40
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/b275fc40
Branch: refs/heads/olingo-206-validator
Commit: b275fc40e95e3d8179bdbf76aa20ec4cec4c681a
Parents: 9806a27
Author: fmartelli <fa...@gmail.com>
Authored: Tue Apr 1 19:02:07 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Tue Apr 1 19:02:07 2014 +0200
----------------------------------------------------------------------
fit/pom.xml | 12 -----
.../org/apache/olingo/fit/AbstractServices.java | 10 ++--
.../olingo/fit/utils/AbstractJSONUtilities.java | 22 ++++-----
.../olingo/fit/utils/AbstractUtilities.java | 11 ++---
.../olingo/fit/utils/AbstractXMLUtilities.java | 49 ++++++++++++--------
.../org/apache/olingo/fit/utils/Commons.java | 4 +-
.../olingo/fit/utils/XMLEventReaderWrapper.java | 21 +++++++--
.../org/apache/olingo/fit/utils/XmlElement.java | 20 ++++++--
.../client/core/it/v3/AsyncTestITCase.java | 1 -
pom.xml | 13 ++++++
10 files changed, 97 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index 55587aa..cac0eca 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -96,18 +96,6 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <useDefaultDelimiters>false</useDefaultDelimiters>
- <delimiters>
- <delimiter>${*}</delimiter>
- </delimiters>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${war.maven.plugin.version}</version>
<configuration>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
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 13c6c49..3d80514 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -1017,15 +1017,17 @@ public abstract class AbstractServices {
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
- InputStream stream = FSManager.instance(getVersion()).readFile(
- basePath + Constants.get(getVersion(), ConstantKey.ENTITY), acceptType == null || acceptType == Accept.TEXT
- ? Accept.XML : acceptType);
-
final AbstractUtilities utils = getUtilities(acceptType);
final List<String> pathElements = Arrays.asList(path.split("\\/"));
+ InputStream stream;
+
if (searchForValue) {
+ stream = FSManager.instance(getVersion()).readFile(
+ basePath + Constants.get(getVersion(), ConstantKey.ENTITY),
+ acceptType == null || acceptType == Accept.TEXT ? Accept.XML : acceptType);
+
stream = utils.getPropertyValue(stream, pathElements);
} else {
String edmType = xml.getEdmTypeFromAtom(entitySetName, entityId, pathElements);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
index 9fd9096..14fff09 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
@@ -63,7 +63,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
new TextNode(Commons.getLinksURI(version, entitySetName, entitykey, link)));
}
- return IOUtils.toInputStream(srcNode.toString());
+ return IOUtils.toInputStream(srcNode.toString(), "UTf-8");
}
@Override
@@ -126,7 +126,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
links.addLinks(title, hrefs);
} else if (Commons.linkInfo.get(version).exists(entitySetName, field.getKey())) {
- links.addInlines(field.getKey(), IOUtils.toInputStream(field.getValue().toString()));
+ links.addInlines(field.getKey(), IOUtils.toInputStream(field.getValue().toString(), "UTf-8"));
}
}
@@ -171,7 +171,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(
Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")"));
- return IOUtils.toInputStream(srcNode.toString());
+ return IOUtils.toInputStream(srcNode.toString(), "UTf-8");
}
@Override
@@ -303,7 +303,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
srcNode.retain(retain);
- return IOUtils.toInputStream(srcNode.toString());
+ return IOUtils.toInputStream(srcNode.toString(), "UTf-8");
}
@Override
@@ -352,7 +352,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
node.set(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME), new TextNode(next));
}
- return IOUtils.toInputStream(node.toString());
+ return IOUtils.toInputStream(node.toString(), "UTf-8");
}
@Override
@@ -375,7 +375,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
toBeChangedNode.set(linkName + Constants.get(version, ConstantKey.JSON_NEXTLINK_SUFFIX), next);
}
- return IOUtils.toInputStream(toBeChangedNode.toString());
+ return IOUtils.toInputStream(toBeChangedNode.toString(), "UTf-8");
}
@Override
@@ -388,7 +388,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final Iterator<Map.Entry<String, JsonNode>> fields = srcObject.fields();
while (fields.hasNext()) {
final Map.Entry<String, JsonNode> field = fields.next();
- res.put(field.getKey(), IOUtils.toInputStream(field.getValue().toString()));
+ res.put(field.getKey(), IOUtils.toInputStream(field.getValue().toString(), "UTf-8"));
}
return res;
@@ -406,7 +406,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
toBeChangedObject.set(property.getKey(), propertyNode);
}
- return IOUtils.toInputStream(toBeChangedObject.toString());
+ return IOUtils.toInputStream(toBeChangedObject.toString(), "UTf-8");
}
@Override
@@ -452,7 +452,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
IOUtils.closeQuietly(content);
srcNode.set(Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(href));
- return IOUtils.toInputStream(srcNode.toString());
+ return IOUtils.toInputStream(srcNode.toString(), "UTf-8");
}
@Override
@@ -481,7 +481,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
((ObjectNode) node).set(path.get(path.size() - 1), replacementNode);
- return IOUtils.toInputStream(srcNode.toString());
+ return IOUtils.toInputStream(srcNode.toString(), "UTf-8");
}
@Override
@@ -500,6 +500,6 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
((ObjectNode) node).set(path.get(path.size() - 1), null);
- return IOUtils.toInputStream(srcNode.toString());
+ return IOUtils.toInputStream(srcNode.toString(), "UTf-8");
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/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 b4d71b5..8df97e3 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
@@ -387,18 +387,14 @@ public abstract class AbstractUtilities {
builder.header("ETag", etag);
}
- if (accept != null) {
- builder.header("Content-Type", accept.toString(version));
- } else {
- builder.header("Content-Type", "*/*");
- }
-
if (status != null) {
builder.status(status);
}
int contentLength = 0;
+ String contentTypeEncoding = StringUtils.EMPTY;
+
if (entity != null) {
try {
final InputStream toBeStreamedBack;
@@ -415,12 +411,15 @@ public abstract class AbstractUtilities {
contentLength = bos.size();
builder.entity(new ByteArrayInputStream(bos.toByteArray()));
+
+ contentTypeEncoding = ";odata.streaming=true;charset=utf-8";
} catch (IOException ioe) {
LOG.error("Error streaming response entity back", ioe);
}
}
builder.header("Content-Length", contentLength);
+ builder.header("Content-Type", (accept == null ? "*/*" : accept.toString(version)) + contentTypeEncoding);
return builder.build();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
index e811388..88349a9 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
@@ -24,7 +24,7 @@ import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import java.io.StringWriter;
+import java.nio.charset.Charset;
import java.util.AbstractMap;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
@@ -75,7 +75,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
ifactory = XMLInputFactory.newInstance();
}
ifactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, false);
- return ifactory.createXMLEventReader(is);
+ return ifactory.createXMLEventReader(is, "utf-8");
}
protected static XMLEventWriter getEventWriter(final OutputStream os) throws XMLStreamException {
@@ -83,7 +83,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
ofactory = XMLOutputFactory.newInstance();
}
- return ofactory.createXMLEventWriter(os);
+ return ofactory.createXMLEventWriter(os, "utf-8");
}
private void writeEvent(final XMLEvent event, final XMLEventWriter writer) {
@@ -369,7 +369,9 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final XmlElement res = new XmlElement();
res.setStart(start);
- StringWriter content = new StringWriter();
+ final Charset encoding = Charset.forName("UTF-8");
+ final ByteArrayOutputStream content = new ByteArrayOutputStream();
+ final OutputStreamWriter writer = new OutputStreamWriter(content, encoding);
int depth = 1;
@@ -385,14 +387,14 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
if (depth == 0) {
res.setEnd(event.asEndElement());
} else {
- event.writeAsEncodedUnicode(content);
+ event.writeAsEncodedUnicode(writer);
}
}
- content.flush();
- content.close();
+ writer.flush();
+ writer.close();
- res.setContent(new ByteArrayInputStream(content.toString().getBytes()));
+ res.setContent(new ByteArrayInputStream(content.toByteArray()));
return res;
}
@@ -851,24 +853,28 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
throw new NotFoundException();
}
+ final Charset encoding = Charset.forName("UTF-8");
+
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final OutputStreamWriter writer = new OutputStreamWriter(bos, encoding);
+
+ writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>".toCharArray());
if (forceFeed || links.size() > 1) {
// build a feed
- bos.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>".getBytes());
- bos.write(("<feed xml:base=\"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "\" "
+ writer.write(("<feed xml:base=\"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "\" "
+ "xmlns=\"http://www.w3.org/2005/Atom\" "
+ "xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" "
+ "xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">")
- .getBytes());
+ .toCharArray());
- bos.write(("<id>" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "entityset(entityid)/" + linkName
- + "</id>").getBytes());
+ writer.write(("<id>" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "entityset(entityid)/" + linkName
+ + "</id>").toCharArray());
- bos.write(("<title type=\"text\">" + linkName + "</title>").getBytes());
- bos.write("<updated>2014-03-03T13:40:49Z</updated>".getBytes());
- bos.write(("<link rel=\"self\" title=\"" + linkName + "\" href=\"" + linkName + "\" />").getBytes());
+ writer.write(("<title type=\"text\">" + linkName + "</title>").toCharArray());
+ writer.write("<updated>2014-03-03T13:40:49Z</updated>".toCharArray());
+ writer.write(("<link rel=\"self\" title=\"" + linkName + "\" href=\"" + linkName + "\" />").toCharArray());
}
for (String link : links) {
@@ -882,7 +888,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
Collections.<String>singletonList("entry"),
0, 1, 1).getValue();
- IOUtils.copy(entry.toStream(), bos);
+ IOUtils.copy(entry.toStream(), writer, encoding);
} catch (Exception e) {
// log and ignore link
LOG.warn("Error parsing uri {}", link, e);
@@ -892,12 +898,15 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
if (forceFeed || links.size() > 1) {
if (StringUtils.isNotBlank(next)) {
- bos.write(String.format("<link rel=\"next\" href=\"%s\" />", next).getBytes());
+ writer.write(String.format("<link rel=\"next\" href=\"%s\" />", next).toCharArray());
}
- bos.write("</feed>".getBytes());
+ writer.write("</feed>".toCharArray());
}
+ writer.flush();
+ writer.close();
+
return new ByteArrayInputStream(bos.toByteArray());
}
@@ -1227,7 +1236,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final XMLEventWriter writer = getEventWriter(bos);
final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
- writer.add(eventFactory.createStartDocument("UTF-8", "1.0"));
+ writer.add(eventFactory.createStartDocument("utf-8", "1.0"));
writer.add(property.getStart());
if (property.getStart().getAttributeByName(new QName(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
index a1c658a..09a6db4 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
@@ -183,7 +183,7 @@ public abstract class Commons {
links.set("value", uris);
}
- return IOUtils.toInputStream(links.toString());
+ return IOUtils.toInputStream(links.toString(), "UTf-8");
}
public static InputStream changeFormat(final InputStream is, final Accept target) {
@@ -197,7 +197,7 @@ public abstract class Commons {
final JsonNode node =
changeFormat((ObjectNode) mapper.readTree(new ByteArrayInputStream(bos.toByteArray())), target);
- return IOUtils.toInputStream(node.toString());
+ return IOUtils.toInputStream(node.toString(), "UTF-8");
} catch (Exception e) {
LOG.error("Error changing format", e);
return new ByteArrayInputStream(bos.toByteArray());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java b/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java
index 6ba0ee9..f75f988 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java
@@ -20,6 +20,10 @@ package org.apache.olingo.fit.utils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CodingErrorAction;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
@@ -28,6 +32,8 @@ import org.apache.commons.io.IOUtils;
public class XMLEventReaderWrapper implements XMLEventReader {
+ private static Charset encoding = Charset.forName("UTF-8");
+
public final static String CONTENT = "CONTENT_TAG";
public final static String CONTENT_STAG = "<" + CONTENT + ">";
@@ -43,12 +49,17 @@ public class XMLEventReaderWrapper implements XMLEventReader {
factory.setProperty(XMLInputFactory.IS_VALIDATING, false);
factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, false);
+ final CharsetDecoder decoder = encoding.newDecoder();
+ decoder.onMalformedInput(CodingErrorAction.IGNORE);
+ decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
+
+ InputStreamReader reader = new InputStreamReader(
+ new ByteArrayInputStream((XMLEventReaderWrapper.CONTENT_STAG
+ + IOUtils.toString(stream, encoding).replaceAll("^<\\?xml.*\\?>", "")
+ + XMLEventReaderWrapper.CONTENT_ETAG).getBytes(encoding)),
+ decoder);
- this.wrapped = factory.createXMLEventReader(
- new ByteArrayInputStream(
- (XMLEventReaderWrapper.CONTENT_STAG
- + IOUtils.toString(stream).replaceAll("^<\\?xml.*\\?>", "")
- + XMLEventReaderWrapper.CONTENT_ETAG).getBytes()));
+ this.wrapped = factory.createXMLEventReader(reader);
init();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/fit/src/main/java/org/apache/olingo/fit/utils/XmlElement.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/XmlElement.java b/fit/src/main/java/org/apache/olingo/fit/utils/XmlElement.java
index e3e2bc8..850c862 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/XmlElement.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/XmlElement.java
@@ -22,7 +22,9 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
+import java.nio.charset.Charset;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.EndElement;
@@ -38,6 +40,8 @@ public class XmlElement {
*/
protected static final Logger LOG = LoggerFactory.getLogger(XmlElement.class);
+ private static Charset encoding = Charset.forName("UTF-8");
+
private StartElement start;
private EndElement end;
@@ -70,20 +74,26 @@ public class XmlElement {
public void setContent(final InputStream content) throws IOException {
this.content.reset();
- IOUtils.copyLarge(content, this.content);
- content.close();
+
+ final InputStreamReader reader = new InputStreamReader(content, encoding);
+ final OutputStreamWriter writer = new OutputStreamWriter(this.content, encoding);
+ IOUtils.copyLarge(reader, writer);
+
+ writer.flush();
+ IOUtils.closeQuietly(reader);
+ IOUtils.closeQuietly(writer);
+ IOUtils.closeQuietly(content);
}
public InputStream toStream() throws Exception {
InputStream res;
try {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final OutputStreamWriter osw = new OutputStreamWriter(bos);
+ final OutputStreamWriter osw = new OutputStreamWriter(bos, encoding);
getStart().writeAsEncodedUnicode(osw);
- osw.flush();
- IOUtils.copy(getContent(), bos);
+ IOUtils.copy(getContent(), osw, encoding);
getEnd().writeAsEncodedUnicode(osw);
osw.flush();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 04ad089..491a8e1 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -39,7 +39,6 @@ import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
-import org.junit.Ignore;
import org.junit.Test;
public class AsyncTestITCase extends AbstractTestITCase {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b275fc40/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index debc464..3f82dd4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -331,6 +331,19 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <useDefaultDelimiters>false</useDefaultDelimiters>
+ <delimiters>
+ <delimiter>${*}</delimiter>
+ </delimiters>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
[28/51] [abbrv] git commit: [OLINGO-227] fix minor xml issues
Posted by sk...@apache.org.
[OLINGO-227] fix minor xml issues
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/2f7a8658
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/2f7a8658
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/2f7a8658
Branch: refs/heads/olingo-206-validator
Commit: 2f7a8658b87654621850066f66538577d67b7b0e
Parents: 27060ff
Author: Stephan Klevenz <st...@sap.com>
Authored: Tue Apr 1 15:56:04 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Tue Apr 1 15:56:04 2014 +0200
----------------------------------------------------------------------
.../resources/v3/Car/filter/VIN add 5 lt 11.xml | 61 +++---
.../resources/v3/Car/filter/VIN div 2 le 8.xml | 23 +--
.../v3/Car/filter/VIN le 18 and VIN gt 12.xml | 23 +--
.../resources/v3/Car/filter/VIN mul 2 le 30.xml | 23 +--
.../filter/day(PurchaseDate) eq 15.xml | 23 +--
.../filter/hour(PurchaseDate) eq 1.xml | 23 +--
.../filter/minute(PurchaseDate) eq 33.xml | 23 +--
.../filter/month(PurchaseDate) eq 12.xml | 23 +--
.../filter/second(PurchaseDate) eq 35.xml | 23 +--
.../filter/year(PurchaseDate) eq 2020.xml | 23 +--
.../filter/isof(Name,'Edm.String') eq true.xml | 22 +--
.../resources/v3/InStreamErrorGetCustomer.xml | 197 ++++++++++++-------
pom.xml | 71 ++++---
13 files changed, 210 insertions(+), 348 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml b/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml
index 5b8c35b..ea2b814 100644
--- a/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml
+++ b/fit/src/main/resources/v3/Car/filter/VIN add 5 lt 11.xml
@@ -1,41 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
-
--->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><author><name /></author></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
+ 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.
-->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
+ <id>http://localhost:x${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id>
+ <title type="text">Car</title>
+ <updated>2014-02-13T14:31:04Z</updated>
+ <link rel="self" title="Car" href="Car" />
+ <author>
+ <name />
+ </author>
+</feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml b/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml
index d771594..eda2ed0 100644
--- a/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml
+++ b/fit/src/main/resources/v3/Car/filter/VIN div 2 le 8.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(11)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(11)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-m
edia/Photo" title="Photo" href="Car(11)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(11)/Video" /><link rel="edit-media" title="Car" href="Car(11)/$value" /><content type="*/*" src="Car(11)/$value" /><m:properties><d:VIN m:type="Edm.Int32">11</d:VIN><d:Description>cenbviijieljtrtdslbuiqubcvhxhzenidqdnaopplvlqc</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(12)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(12)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(12)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href
="Car(12)/Video" /><link rel="edit-media" title="Car" href="Car(12)/$value" /><content type="*/*" src="Car(12)/$value" /><m:properties><d:VIN m:type="Edm.Int32">12</d:VIN><d:Description>lx</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="
true" /></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ�
��マび暦ダソク歹まあa裹ソハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30
/Static.svc/Car(16)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(16)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(16)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(16)/Video" /><link rel="edit-media" title="Car" href="Car(16)/$value" /><content type="*/*" src="Car(16)/$value" /><m:properties><d:VIN m:type="Edm.Int32">16</d:VIN><d:Description>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(17)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsof
t.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(17)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(17)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(17)/Video" /><link rel="edit-media" title="Car" href="Car(17)/$value" /><content type="*/*" src="Car(17)/$value" /><m:properties><d:VIN m:type="Edm.Int32">17</d:VIN><d:Description>まァチボЯ暦マチま匚ぁそタんゼびたチほ黑ポびぁソёん欲欲ヲをァァポぴグ亜チポグヲミそハせゼ珱ゼぜせポゼゼa裹黑そまそチ</d:Description></m:properties></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(11)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(11)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(11
)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(11)/Video" /><link rel="edit-media" title="Car" href="Car(11)/$value" /><content type="*/*" src="Car(11)/$value" /><m:properties><d:VIN m:type="Edm.Int32">11</d:VIN><d:Description>cenbviijieljtrtdslbuiqubcvhxhzenidqdnaopplvlqc</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(12)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(12)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(12)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(12)/Video" /><link rel="edit-med
ia" title="Car" href="Car(12)/$value" /><content type="*/*" src="Car(12)/$value" /><m:properties><d:VIN m:type="Edm.Int32">12</d:VIN><d:Description>lx</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="true" /></m:properties></entry><entry>
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ匚マび暦ダソク歹まあa裹ソ
ハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(16)</id><category term
="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(16)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(16)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(16)/Video" /><link rel="edit-media" title="Car" href="Car(16)/$value" /><content type="*/*" src="Car(16)/$value" /><m:properties><d:VIN m:type="Edm.Int32">16</d:VIN><d:Description>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(17)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"
/><link rel="edit" title="Car" href="Car(17)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(17)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(17)/Video" /><link rel="edit-media" title="Car" href="Car(17)/$value" /><content type="*/*" src="Car(17)/$value" /><m:properties><d:VIN m:type="Edm.Int32">17</d:VIN><d:Description>まァチボЯ暦マチま匚ぁそタんゼびたチほ黑ポびぁソёん欲欲ヲをァァポぴグ亜チポグヲミそハせゼ珱ゼぜせポゼゼa裹黑そまそチ</d:Description></m:properties></entry></feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml b/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml
index 471d9af..935391e 100644
--- a/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml
+++ b/fit/src/main/resources/v3/Car/filter/VIN le 18 and VIN gt 12.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:06Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-m
edia/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="true" /></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" titl
e="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ匚マび暦ダソク歹まあa裹ソハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-medi
a/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(16)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(16)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(16)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(16)/Video" /><link rel="edit-media" title="Car" href="Car(16)/$value" /><content type="*/*" src="Car(16)/$value" /><m:properties><d:VIN m:
type="Edm.Int32">16</d:VIN><d:Description>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(17)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(17)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(17)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(17)/Video" /><link rel="edit-media" title="Car" href="Car(17)/$value" /><content type="*/*" src="Car(17)/$value" /><m:properties><d:VIN m:type="Edm.Int32">17</d:VIN><d:Description>まァチボЯ暦マチま匚ぁそタんゼびたチほ黑ポびぁソёん欲欲ヲ�
��ァァポぴグ亜チポグヲミそハせゼ珱ゼぜせポゼゼa裹黑そまそチ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(18)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(18)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(18)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(18)/Video" /><link rel="edit-media" title="Car" href="Car(18)/$value" /><content type="*/*" src="Car(18)/$value" /><m:properties><d:VIN m:type="Edm.Int32">18</d:VIN><d:Description>ёゼボタひべバタぞァяЯ畚ダソゾゾЯ歹ぺボぜたソ畚珱マ欲マグあ畚九ァ畚マグ
裹ミゼァ欲ソ弌畚マ弌チ暦ァボぜ裹ミЯaぼひポをゾ弌歹</d:Description></m:properties></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:06Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13
)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="true" /></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><conte
nt type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ匚マび暦ダソク歹まあa裹ソハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/V
ideo" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(16)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(16)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(16)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(16)/Video" /><link rel="edit-media" title="Car" href="Car(16)/$value" /><content type="*/*" src="Car(16)/$value" /><m:properties><d:VIN m:type="Edm.Int32">16</d:VIN><d:Descript
ion>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(17)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(17)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(17)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(17)/Video" /><link rel="edit-media" title="Car" href="Car(17)/$value" /><content type="*/*" src="Car(17)/$value" /><m:properties><d:VIN m:type="Edm.Int32">17</d:VIN><d:Description>まァチボЯ暦マチま匚ぁそタんゼびたチほ黑ポびぁソёん欲欲ヲをァァポぴグ亜チポグヲミそ
ハせゼ珱ゼぜせポゼゼa裹黑そまそチ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(18)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(18)" /><title /><updated>2014-02-13T14:31:06Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(18)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(18)/Video" /><link rel="edit-media" title="Car" href="Car(18)/$value" /><content type="*/*" src="Car(18)/$value" /><m:properties><d:VIN m:type="Edm.Int32">18</d:VIN><d:Description>ёゼボタひべバタぞァяЯ畚ダソゾゾЯ歹ぺボぜたソ畚珱マ欲マグあ畚九ァ畚マグ裹ミゼァ欲ソ弌畚マ弌チ暦�
�ボぜ裹ミЯaぼひポをゾ弌歹</d:Description></m:properties></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml b/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml
index 6fa295f..de88604 100644
--- a/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml
+++ b/fit/src/main/resources/v3/Car/filter/VIN mul 2 le 30.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(11)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(11)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-m
edia/Photo" title="Photo" href="Car(11)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(11)/Video" /><link rel="edit-media" title="Car" href="Car(11)/$value" /><content type="*/*" src="Car(11)/$value" /><m:properties><d:VIN m:type="Edm.Int32">11</d:VIN><d:Description>cenbviijieljtrtdslbuiqubcvhxhzenidqdnaopplvlqc</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(12)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(12)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(12)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href
="Car(12)/Video" /><link rel="edit-media" title="Car" href="Car(12)/$value" /><content type="*/*" src="Car(12)/$value" /><m:properties><d:VIN m:type="Edm.Int32">12</d:VIN><d:Description>lx</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="
true" /></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ�
��マび暦ダソク歹まあa裹ソハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car</id><title type="text">Car</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="Car" href="Car" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(11)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(11)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(11
)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(11)/Video" /><link rel="edit-media" title="Car" href="Car(11)/$value" /><content type="*/*" src="Car(11)/$value" /><m:properties><d:VIN m:type="Edm.Int32">11</d:VIN><d:Description>cenbviijieljtrtdslbuiqubcvhxhzenidqdnaopplvlqc</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(12)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(12)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(12)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(12)/Video" /><link rel="edit-med
ia" title="Car" href="Car(12)/$value" /><content type="*/*" src="Car(12)/$value" /><m:properties><d:VIN m:type="Edm.Int32">12</d:VIN><d:Description>lx</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(13)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(13)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(13)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(13)/Video" /><link rel="edit-media" title="Car" href="Car(13)/$value" /><content type="*/*" src="Car(13)/$value" /><m:properties><d:VIN m:type="Edm.Int32">13</d:VIN><d:Description m:null="true" /></m:properties></entry><entry>
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(14)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(14)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(14)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(14)/Video" /><link rel="edit-media" title="Car" href="Car(14)/$value" /><content type="*/*" src="Car(14)/$value" /><m:properties><d:VIN m:type="Edm.Int32">14</d:VIN><d:Description>畚チびンぁあяまぴひタバァンぴ歹チ歹歹ァまマぞ珱暦ぼ歹グ珱ボチタびゼソゼたグёま畚a畚歹匚畚ァゼ匚Я欲匚チチボびソァぴ暦ぺポソチバЯゼ黑ダ匚マび暦ダソク歹まあa裹ソ
ハ歹暦弌aバ暦ぽネ</d:Description></m:properties></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Car(15)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Car" href="Car(15)" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="Car(15)/Photo" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Car(15)/Video" /><link rel="edit-media" title="Car" href="Car(15)/$value" /><content type="*/*" src="Car(15)/$value" /><m:properties><d:VIN m:type="Edm.Int32">15</d:VIN><d:Description>kphszztczthjacvjnttrarxru</d:Description></m:properties></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml b/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml
index e77bdfe..0ab5b04 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/day(PurchaseDate) eq 15.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml b/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml
index cef8ad6..577a485 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/hour(PurchaseDate) eq 1.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml b/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml
index cef8ad6..577a485 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/minute(PurchaseDate) eq 33.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml b/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml
index 3d145e0..563fd3e 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/month(PurchaseDate) eq 12.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry><entry><id>http://localhost:${ca
rgo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-1)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-1)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-1)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>mfhgyißxesckygsslbksqvcpohjienkcfbtrssp</uri><email>cybsycxhjrazcaxf</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-1)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties
><d:ComputerDetailId m:type="Edm.Int32">-1</d:ComputerDetailId><d:Manufacturer>cybsycxhjrazcaxf</d:Manufacturer><d:Model>mfhgyißxesckygsslbksqvcpohjienkcfbtrssp</d:Model><d:Serial>あァミゾダぜ裹あゼぞん匚畚バをミぼヲソン裹ぽハゾ黑ぼび</d:Serial><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>チ欲ァミ畚珱ボ欲をぴンたァ黑タァそクほァ黑ゼ畚グ弌亜ほチをaべあタ</d:element><d:element>タ縷ソ畚ボたひ暦裹ぞぽチグaぁァ亜チゼひzネaぜボёタグネ黑バタびチ弌ほ黑グマ亜ぼあソポゾポべク畚畚をヲグチЯチzァほチボ匚欲ンタミゼ弌ぞ欲ゼゼ畚ポ裹縷ゾぼバヲ歹ひゾそボポひボチほまハぞそたソ</d:element><d:element>udjcekzitroessd</d:element><d:element>shxnubznxdumkraixsjsskrspkss</d:element><d:element>vugqblidbkbfkppfbbkanvnflueqdousryyhhucoxtpbbnyeecbsauzaceu</d:element><d:element>aerlqnsczhßgivchizyapazitnsszugryqlupnußjgxg</d:element>
<d:element>あべ暦裹zぽタゾ歹яひチミせチ亜あチ九ぞミボёボ暦ァ黑ソポ匚ポあァせソ亜ぞぼゼグァたボ九ゼネя裹歹バ亜亜ぜバaソびひせバァあ歹あァぜ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">9999-12-31T23:59:59.9999999</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-69.6411071913679</d:Width><d:Height m:type="Edm.Decimal">1451.59900018645</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:04Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/St
atic.svc/ComputerDetail(-1)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-1)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-1)/Computer" /><title /><updated>2014-02-13T14:31:04Z</updated><author><name /><uri>mfhgyißxesckygsslbksqvcpohjienkcfbtrssp</uri><email>cybsycxhjrazcaxf</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-1)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32
">-1</d:ComputerDetailId><d:Manufacturer>cybsycxhjrazcaxf</d:Manufacturer><d:Model>mfhgyißxesckygsslbksqvcpohjienkcfbtrssp</d:Model><d:Serial>あァミゾダぜ裹あゼぞん匚畚バをミぼヲソン裹ぽハゾ黑ぼび</d:Serial><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>チ欲ァミ畚珱ボ欲をぴンたァ黑タァそクほァ黑ゼ畚グ弌亜ほチをaべあタ</d:element><d:element>タ縷ソ畚ボたひ暦裹ぞぽチグaぁァ亜チゼひzネaぜボёタグネ黑バタびチ弌ほ黑グマ亜ぼあソポゾポべク畚畚をヲグチЯチzァほチボ匚欲ンタミゼ弌ぞ欲ゼゼ畚ポ裹縷ゾぼバヲ歹ひゾそボポひボチほまハぞそたソ</d:element><d:element>udjcekzitroessd</d:element><d:element>shxnubznxdumkraixsjsskrspkss</d:element><d:element>vugqblidbkbfkppfbbkanvnflueqdousryyhhucoxtpbbnyeecbsauzaceu</d:element><d:element>aerlqnsczhßgivchizyapazitnsszugryqlupnußjgxg</d:element><d:element>あべ暦裹zぽタゾ歹
яひチミせチ亜あチ九ぞミボёボ暦ァ黑ソポ匚ポあァせソ亜ぞぼゼグァたボ九ゼネя裹歹バ亜亜ぜバaソびひせバァあ歹あァぜ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">9999-12-31T23:59:59.9999999</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-69.6411071913679</d:Width><d:Height m:type="Edm.Decimal">1451.59900018645</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml b/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml
index cef8ad6..577a485 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/second(PurchaseDate) eq 35.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
\ No newline at end of file
[23/51] [abbrv] git commit: [OLINGO-227] added some rat test and
gitignore excludes for generated files
Posted by sk...@apache.org.
[OLINGO-227] added some rat test and gitignore excludes for generated files
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/d4c2484d
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/d4c2484d
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/d4c2484d
Branch: refs/heads/olingo-206-validator
Commit: d4c2484dfbc3ff0ba64abb4a6a493acfac0c0624
Parents: 4a19c8d
Author: Stephan Klevenz <st...@sap.com>
Authored: Tue Apr 1 13:54:06 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Tue Apr 1 13:55:16 2014 +0200
----------------------------------------------------------------------
.gitignore | 2 ++
pom.xml | 2 ++
2 files changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d4c2484d/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 2095344..947434b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,5 @@ classes
.DS_Store
*.local
nb-configuration.xml
+.externalToolBuilders
+maven-eclipse.xml
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d4c2484d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6b0668b..b0c4839 100644
--- a/pom.xml
+++ b/pom.xml
@@ -401,6 +401,8 @@
<exclude>**/NOTICE</exclude>
<exclude>**/DEPENDENCIES</exclude>
<exclude>**/nb-configuration.xml</exclude>
+ <exclude>**/.externalToolBuilders/**</exclude>
+ <exclude>**/maven-eclipse.xml</exclude>
</excludes>
</configuration>
</execution>
[20/51] [abbrv] git commit: [OLINGO-205,
OLINGO-175] provided JSON integration tests + refactoring and fixes
Posted by sk...@apache.org.
[OLINGO-205, OLINGO-175] provided JSON integration tests + refactoring and fixes
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/c73772f0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/c73772f0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/c73772f0
Branch: refs/heads/olingo-206-validator
Commit: c73772f041d048e0a862d95361526a801b4cb712
Parents: de591bb
Author: fmartelli <fa...@gmail.com>
Authored: Mon Mar 31 17:16:44 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Mar 31 17:16:44 2014 +0200
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 36 +-
.../java/org/apache/olingo/fit/V4NorthWind.java | 5 +-
.../org/apache/olingo/fit/V4NorthWindExt.java | 5 +-
.../olingo/fit/utils/AbstractJSONUtilities.java | 78 +--
.../olingo/fit/utils/AbstractUtilities.java | 52 +-
.../olingo/fit/utils/AbstractXMLUtilities.java | 149 +++---
.../org/apache/olingo/fit/utils/Commons.java | 27 +-
.../apache/olingo/fit/utils/ConstantKey.java | 67 +++
.../org/apache/olingo/fit/utils/Constants.java | 167 +++---
.../apache/olingo/fit/utils/ODataVersion.java | 2 +-
.../fit/utils/XHTTPMethodInterceptor.java | 5 +-
.../olingo/fit/utils/v3/XMLUtilities.java | 7 +-
.../olingo/fit/utils/v4/XMLUtilities.java | 3 +-
.../olingo/client/api/data/ServiceDocument.java | 15 -
.../retrieve/ODataPropertyRequestImpl.java | 2 +-
.../core/data/AbstractServiceDocument.java | 33 +-
.../data/JSONServiceDocumentDeserializer.java | 35 +-
.../data/XMLServiceDocumentDeserializer.java | 33 +-
.../core/data/v3/JSONServiceDocumentImpl.java | 32 --
.../core/data/v3/XMLServiceDocumentImpl.java | 18 -
.../core/data/v4/AbstractServiceDocument.java | 40 --
.../core/data/v4/JSONServiceDocumentImpl.java | 15 -
.../core/data/v4/XMLServiceDocumentImpl.java | 1 -
.../client/core/op/AbstractODataBinder.java | 22 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 12 +-
.../client/core/it/v3/AsyncTestITCase.java | 1 -
.../it/v3/NavigationLinkCreateTestITCase.java | 534 -------------------
.../client/core/it/v3/PropertyTestITCase.java | 4 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 20 +-
.../client/core/it/v4/EntitySetTestITCase.java | 8 +-
.../core/it/v4/ServiceDocumentTestITCase.java | 8 +-
.../client/core/v4/ServiceDocumentTest.java | 14 +-
.../olingo/client/core/v4/serviceDocument.json | 1 +
.../api/domain/ODataServiceDocument.java | 20 -
.../core/data/AbstractJsonDeserializer.java | 3 +-
.../core/data/JSONEntryDeserializer.java | 35 +-
.../commons/core/data/JSONFeedDeserializer.java | 28 +-
.../olingo/commons/core/data/JSONFeedImpl.java | 10 +-
.../core/data/JSONODataErrorDeserializer.java | 6 +-
.../core/data/JSONPropertyDeserializer.java | 30 +-
.../primitivetype/EdmGeographyMultiPoint.java | 1 -
.../primitivetype/EdmGeometryCollection.java | 1 -
.../core/op/AbstractODataDeserializer.java | 16 +-
43 files changed, 558 insertions(+), 1043 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
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 237d0ae..13c6c49 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -24,8 +24,6 @@ import org.apache.olingo.fit.utils.AbstractJSONUtilities;
import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.FSManager;
-import static org.apache.olingo.fit.utils.Constants.*;
-
import org.apache.olingo.fit.methods.MERGE;
import org.apache.olingo.fit.methods.PATCH;
import org.apache.olingo.fit.utils.AbstractUtilities;
@@ -57,6 +55,7 @@ import javax.ws.rs.core.Response;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,7 +70,6 @@ public abstract class AbstractServices {
private static final Set<ODataVersion> INITIALIZED = EnumSet.noneOf(ODataVersion.class);
protected abstract ODataVersion getVersion();
-
protected final AbstractXMLUtilities xml;
protected final AbstractJSONUtilities json;
@@ -107,7 +105,8 @@ public abstract class AbstractServices {
}
return xml.createResponse(
- FSManager.instance(getVersion()).readFile(SERVICES, acceptType), null, acceptType);
+ FSManager.instance(getVersion()).readFile(Constants.get(getVersion(), ConstantKey.SERVICES), acceptType),
+ null, acceptType);
} catch (Exception e) {
return xml.createFaultResponse(accept, e);
}
@@ -122,7 +121,7 @@ public abstract class AbstractServices {
@Path("/$metadata")
@Produces("application/xml")
public Response getMetadata() {
- return getMetadata(METADATA);
+ return getMetadata(Constants.get(getVersion(), ConstantKey.METADATA));
}
/**
@@ -134,7 +133,7 @@ public abstract class AbstractServices {
@Path("/large/$metadata")
@Produces("application/xml")
public Response getLargeMetadata() {
- return getMetadata("large" + StringUtils.capitalize(METADATA));
+ return getMetadata("large" + StringUtils.capitalize(Constants.get(getVersion(), ConstantKey.METADATA)));
}
protected Response getMetadata(final String filename) {
@@ -150,7 +149,7 @@ public abstract class AbstractServices {
// public Response getEntityReference(@QueryParam("$id") String id){
// return null;
// }
-
+
/**
* Retrieve entity reference sample.
*
@@ -176,7 +175,8 @@ public abstract class AbstractServices {
final String filename = Base64.encodeBase64String(path.getBytes("UTF-8"));
return utils.getValue().createResponse(
- FSManager.instance(getVersion()).readFile(Constants.REF + File.separatorChar + filename, utils.getKey()),
+ FSManager.instance(getVersion()).readFile(Constants.get(getVersion(), ConstantKey.REF)
+ + File.separatorChar + filename, utils.getKey()),
null,
utils.getKey());
} catch (Exception e) {
@@ -419,15 +419,20 @@ public abstract class AbstractServices {
builder.append(basePath);
if (StringUtils.isNotBlank(orderby)) {
- builder.append(ORDERBY).append(File.separatorChar).append(orderby).append(File.separatorChar);
+ builder.append(Constants.get(getVersion(), ConstantKey.ORDERBY)).append(File.separatorChar).
+ append(orderby).append(File.separatorChar);
}
if (StringUtils.isNotBlank(filter)) {
- builder.append(FILTER).append(File.separatorChar).append(filter.replaceAll("/", "."));
+ builder.append(Constants.get(getVersion(), ConstantKey.FILTER)).append(File.separatorChar).
+ append(filter.replaceAll("/", "."));
} else if (StringUtils.isNotBlank(skiptoken)) {
- builder.append(SKIP_TOKEN).append(File.separatorChar).append(skiptoken);
+ builder.append(Constants.get(getVersion(), ConstantKey.SKIP_TOKEN)).append(File.separatorChar).
+ append(skiptoken);
} else {
- builder.append(Commons.getLinkInfo().get(getVersion()).isSingleton(name) ? ENTITY : FEED);
+ builder.append(Commons.getLinkInfo().get(getVersion()).isSingleton(name)
+ ? Constants.get(getVersion(), ConstantKey.ENTITY)
+ : Constants.get(getVersion(), ConstantKey.FEED));
}
InputStream feed = FSManager.instance(getVersion()).readFile(builder.toString(), acceptType);
@@ -524,7 +529,8 @@ public abstract class AbstractServices {
if (keyAsSegment) {
entity = utils.getValue().addEditLink(
- entity, entitySetName, Constants.DEFAULT_SERVICE_URL + entitySetName + "/" + entityId);
+ entity, entitySetName,
+ Constants.get(getVersion(), ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "/" + entityId);
}
if (StringUtils.isNotBlank(select)) {
@@ -589,7 +595,7 @@ public abstract class AbstractServices {
final String basePath =
entitySetName + File.separatorChar + Commons.getEntityKey(entityId) + File.separatorChar;
- FSManager.instance(getVersion()).deleteFile(basePath + ENTITY);
+ FSManager.instance(getVersion()).deleteFile(basePath + Constants.get(getVersion(), ConstantKey.ENTITY));
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
} catch (Exception e) {
@@ -1012,7 +1018,7 @@ public abstract class AbstractServices {
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
InputStream stream = FSManager.instance(getVersion()).readFile(
- basePath + ENTITY, acceptType == null || acceptType == Accept.TEXT
+ basePath + Constants.get(getVersion(), ConstantKey.ENTITY), acceptType == null || acceptType == Accept.TEXT
? Accept.XML : acceptType);
final AbstractUtilities utils = getUtilities(acceptType);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
index 5ef82d7..b11d3e5 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
@@ -23,7 +23,8 @@ import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.apache.cxf.interceptor.InInterceptors;
-import static org.apache.olingo.fit.utils.Constants.METADATA;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
@Path("/V40/NorthWind.svc")
@InInterceptors(classes = XHTTPMethodInterceptor.class)
@@ -40,7 +41,7 @@ public class V4NorthWind extends AbstractServices {
@Override
public Response getMetadata() {
- return getMetadata("northwind-" + METADATA);
+ return getMetadata("northwind-" + Constants.get(getVersion(), ConstantKey.METADATA));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
index a3d60a7..b5d4bda 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
@@ -23,7 +23,8 @@ import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.apache.cxf.interceptor.InInterceptors;
-import static org.apache.olingo.fit.utils.Constants.METADATA;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor;
@Path("/V40/NorthWindExt.svc")
@@ -41,7 +42,7 @@ public class V4NorthWindExt extends AbstractServices {
@Override
public Response getMetadata() {
- return getMetadata("northwindExt-" + METADATA);
+ return getMetadata("northwindExt-" + Constants.get(getVersion(), ConstantKey.METADATA));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
index c62d341..9fd9096 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.fit.utils;
-import static org.apache.olingo.fit.utils.Constants.*;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -61,7 +59,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
IOUtils.closeQuietly(is);
for (String link : links) {
- srcNode.set(link + JSON_NAVIGATION_SUFFIX,
+ srcNode.set(link + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX),
new TextNode(Commons.getLinksURI(version, entitySetName, entitykey, link)));
}
@@ -81,10 +79,10 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
while (fieldIter.hasNext()) {
final String field = fieldIter.next();
- if (field.endsWith(JSON_NAVIGATION_BIND_SUFFIX)
- || field.endsWith(JSON_NAVIGATION_SUFFIX)
- || field.endsWith(JSON_MEDIA_SUFFIX)
- || field.endsWith(JSON_EDITLINK_NAME)) {
+ if (field.endsWith(Constants.get(version, ConstantKey.JSON_NAVIGATION_BIND_SUFFIX))
+ || field.endsWith(Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX))
+ || field.endsWith(Constants.get(version, ConstantKey.JSON_MEDIA_SUFFIX))
+ || field.endsWith(Constants.get(version, ConstantKey.JSON_EDITLINK_NAME))) {
if (field.indexOf('@') > 0) {
links.add(field.substring(0, field.indexOf('@')));
} else {
@@ -113,7 +111,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
while (fieldIter.hasNext()) {
final Map.Entry<String, JsonNode> field = fieldIter.next();
- if (field.getKey().endsWith(JSON_NAVIGATION_BIND_SUFFIX)) {
+ if (field.getKey().endsWith(Constants.get(version, ConstantKey.JSON_NAVIGATION_BIND_SUFFIX))) {
final String title = field.getKey().substring(0, field.getKey().indexOf('@'));
final List<String> hrefs = new ArrayList<String>();
if (field.getValue().isArray()) {
@@ -148,17 +146,17 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
if (links != null) {
for (String linkTitle : links.getLinkNames()) {
// normalize link
- srcNode.remove(linkTitle + JSON_NAVIGATION_BIND_SUFFIX);
+ srcNode.remove(linkTitle + Constants.get(version, ConstantKey.JSON_NAVIGATION_BIND_SUFFIX));
srcNode.set(
- linkTitle + JSON_NAVIGATION_SUFFIX,
+ linkTitle + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX),
new TextNode(String.format("%s(%s)/%s", entitySetName, entityKey, linkTitle)));
}
for (String linkTitle : links.getInlineNames()) {
// normalize link if exist; declare a new one if missing
- srcNode.remove(linkTitle + JSON_NAVIGATION_BIND_SUFFIX);
+ srcNode.remove(linkTitle + Constants.get(version, ConstantKey.JSON_NAVIGATION_BIND_SUFFIX));
srcNode.set(
- linkTitle + JSON_NAVIGATION_SUFFIX,
+ linkTitle + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX),
new TextNode(String.format("%s(%s)/%s", entitySetName, entityKey, linkTitle)));
// remove inline
@@ -170,8 +168,8 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
}
srcNode.set(
- JSON_EDITLINK_NAME,
- new TextNode(Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")"));
+ Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(
+ Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")"));
return IOUtils.toInputStream(srcNode.toString());
}
@@ -190,8 +188,9 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final String entitySetName, final String entityId, final List<String> path, final String edmType)
throws Exception {
- final InputStream src =
- fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.JSON_FULLMETA);
+ final InputStream src = fsManager.readFile(
+ Commons.getEntityBasePath(entitySetName, entityId) + Constants.get(version, ConstantKey.ENTITY),
+ Accept.JSON_FULLMETA);
final ObjectMapper mapper = new ObjectMapper();
final JsonNode srcNode = mapper.readTree(src);
@@ -199,7 +198,9 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode propertyNode = new ObjectNode(JsonNodeFactory.instance);
if (StringUtils.isNotBlank(edmType)) {
- propertyNode.put(JSON_ODATAMETADATA_NAME, ODATA_METADATA_PREFIX + edmType);
+ propertyNode.put(Constants.get(
+ version, ConstantKey.JSON_ODATAMETADATA_NAME),
+ Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX) + edmType);
}
JsonNode jsonNode = getProperty(srcNode, path);
@@ -241,7 +242,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectMapper mapper = new ObjectMapper();
final JsonNode srcNode = mapper.readTree(src);
- ((ObjectNode) srcNode).put(ODATA_COUNT_NAME, count);
+ ((ObjectNode) srcNode).put(Constants.get(version, ConstantKey.ODATA_COUNT_NAME), count);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
mapper.writeValue(bos, srcNode);
@@ -258,14 +259,14 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode res;
- final JsonNode value = node.get(JSON_VALUE_NAME);
+ final JsonNode value = node.get(Constants.get(version, ConstantKey.JSON_VALUE_NAME));
if (value.isArray()) {
res = mapper.createObjectNode();
res.set("value", value);
- final JsonNode next = node.get(JSON_NEXTLINK_NAME);
+ final JsonNode next = node.get(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME));
if (next != null) {
- res.set(JSON_NEXTLINK_NAME, next);
+ res.set(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME), next);
}
} else {
res = (ObjectNode) value;
@@ -286,18 +287,18 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
final Set<String> retain = new HashSet<String>();
- retain.add(JSON_ID_NAME);
- retain.add(JSON_TYPE_NAME);
- retain.add(JSON_EDITLINK_NAME);
- retain.add(JSON_NEXTLINK_NAME);
- retain.add(JSON_ODATAMETADATA_NAME);
- retain.add(JSON_VALUE_NAME);
+ retain.add(Constants.get(version, ConstantKey.JSON_ID_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_TYPE_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_EDITLINK_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_ODATAMETADATA_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_VALUE_NAME));
for (String name : propertyNames) {
retain.add(name);
- retain.add(name + JSON_NAVIGATION_SUFFIX);
- retain.add(name + JSON_MEDIA_SUFFIX);
- retain.add(name + JSON_TYPE_SUFFIX);
+ retain.add(name + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX));
+ retain.add(name + Constants.get(version, ConstantKey.JSON_MEDIA_SUFFIX));
+ retain.add(name + Constants.get(version, ConstantKey.JSON_TYPE_SUFFIX));
}
srcNode.retain(retain);
@@ -344,10 +345,11 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
bos.write("]".getBytes());
}
- node.set(JSON_VALUE_NAME, mapper.readTree(new ByteArrayInputStream(bos.toByteArray())));
+ node.set(Constants.get(version, ConstantKey.JSON_VALUE_NAME),
+ mapper.readTree(new ByteArrayInputStream(bos.toByteArray())));
if (StringUtils.isNotBlank(next)) {
- node.set(JSON_NEXTLINK_NAME, new TextNode(next));
+ node.set(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME), new TextNode(next));
}
return IOUtils.toInputStream(node.toString());
@@ -362,15 +364,15 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode toBeChangedNode = (ObjectNode) mapper.readTree(toBeChanged);
final ObjectNode replacementNode = (ObjectNode) mapper.readTree(replacement);
- if (toBeChangedNode.get(linkName + JSON_NAVIGATION_SUFFIX) == null) {
+ if (toBeChangedNode.get(linkName + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX)) == null) {
throw new NotFoundException();
}
- toBeChangedNode.set(linkName, replacementNode.get(JSON_VALUE_NAME));
+ toBeChangedNode.set(linkName, replacementNode.get(Constants.get(version, ConstantKey.JSON_VALUE_NAME)));
- final JsonNode next = replacementNode.get(linkName + JSON_NEXTLINK_NAME);
+ final JsonNode next = replacementNode.get(linkName + Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME));
if (next != null) {
- toBeChangedNode.set(linkName + JSON_NEXTLINK_SUFFIX, next);
+ toBeChangedNode.set(linkName + Constants.get(version, ConstantKey.JSON_NEXTLINK_SUFFIX), next);
}
return IOUtils.toInputStream(toBeChangedNode.toString());
@@ -437,7 +439,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
}
}
- final JsonNode next = srcNode.get(JSON_NEXTLINK_NAME);
+ final JsonNode next = srcNode.get(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME));
return new SimpleEntry<String, List<String>>(next == null ? null : next.asText(), links);
}
@@ -449,7 +451,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode srcNode = (ObjectNode) mapper.readTree(content);
IOUtils.closeQuietly(content);
- srcNode.set(JSON_EDITLINK_NAME, new TextNode(href));
+ srcNode.set(Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(href));
return IOUtils.toInputStream(srcNode.toString());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/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 7b74b62..5b23366 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
@@ -19,7 +19,6 @@
package org.apache.olingo.fit.utils;
import static org.apache.olingo.fit.utils.Commons.sequence;
-import static org.apache.olingo.fit.utils.Constants.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -134,7 +133,8 @@ public abstract class AbstractUtilities {
// 0. Get the path
// -----------------------------------------
final String path =
- entitySetName + File.separatorChar + Commons.getEntityKey(key) + File.separatorChar + ENTITY;
+ entitySetName + File.separatorChar + Commons.getEntityKey(key) + File.separatorChar
+ + Constants.get(version, ConstantKey.ENTITY);
// -----------------------------------------
// -----------------------------------------
@@ -229,7 +229,7 @@ public abstract class AbstractUtilities {
// -----------------------------------------
final FileObject fo = fsManager.putInMemory(
normalizedEntity,
- fsManager.getAbsolutePath(path + ENTITY, getDefaultFormat()));
+ fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY), getDefaultFormat()));
// -----------------------------------------
// -----------------------------------------
@@ -282,7 +282,8 @@ public abstract class AbstractUtilities {
// -----------------------------------------
// 1. save the media entity value
// -----------------------------------------
- fsManager.putInMemory(is, fsManager.getAbsolutePath(path + MEDIA_CONTENT_FILENAME, null));
+ fsManager.putInMemory(is, fsManager.getAbsolutePath(path
+ + Constants.get(version, ConstantKey.MEDIA_CONTENT_FILENAME), null));
IOUtils.closeQuietly(is);
// -----------------------------------------
@@ -291,13 +292,13 @@ public abstract class AbstractUtilities {
// -----------------------------------------
final String entityURI = Commons.getEntityURI(entitySetName, entityKey);
String entity = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
- + "<entry xml:base=\"" + DEFAULT_SERVICE_URL + "\" "
+ + "<entry xml:base=\"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "\" "
+ "xmlns=\"http://www.w3.org/2005/Atom\" "
+ "xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" "
+ "xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\" "
+ "xmlns:georss=\"http://www.georss.org/georss\" "
+ "xmlns:gml=\"http://www.opengis.net/gml\">"
- + "<id>" + DEFAULT_SERVICE_URL + entityURI + "</id>"
+ + "<id>" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entityURI + "</id>"
+ "<category term=\"Microsoft.Test.OData.Services.AstoriaDefaultService." + entitySetName + "\" "
+ "scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />"
+ "<link rel=\"edit\" title=\"Car\" href=\"" + entityURI + "\" />"
@@ -310,16 +311,18 @@ public abstract class AbstractUtilities {
+ "</entry>";
fsManager.putInMemory(
- IOUtils.toInputStream(entity), fsManager.getAbsolutePath(path + ENTITY, Accept.ATOM));
+ IOUtils.toInputStream(entity),
+ fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY), Accept.ATOM));
// -----------------------------------------
// -----------------------------------------
// 3. save entity as json
// -----------------------------------------
entity = "{"
- + "\"odata.metadata\": \"" + DEFAULT_SERVICE_URL + "/$metadata#" + entitySetName + "/@Element\","
+ + "\"odata.metadata\": \"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL)
+ + "/$metadata#" + entitySetName + "/@Element\","
+ "\"odata.type\": \"Microsoft.Test.OData.Services.AstoriaDefaultService." + entitySetName + "\","
- + "\"odata.id\": \"" + DEFAULT_SERVICE_URL + entityURI + "\","
+ + "\"odata.id\": \"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entityURI + "\","
+ "\"odata.editLink\": \"" + entityURI + "\","
+ "\"odata.mediaEditLink\": \"" + entityURI + "/$value\","
+ "\"odata.mediaReadLink\": \"" + entityURI + "/$value\","
@@ -328,7 +331,8 @@ public abstract class AbstractUtilities {
+ "\"Description\": null" + "}";
fsManager.putInMemory(
- IOUtils.toInputStream(entity), fsManager.getAbsolutePath(path + ENTITY, Accept.JSON_FULLMETA));
+ IOUtils.toInputStream(entity), fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY),
+ Accept.JSON_FULLMETA));
// -----------------------------------------
return readEntity(entitySetName, entityKey, getDefaultFormat()).getValue();
@@ -376,7 +380,7 @@ public abstract class AbstractUtilities {
final InputStream entity, final String etag, final Accept accept, final Response.Status status) {
final Response.ResponseBuilder builder = Response.ok();
if (version == ODataVersion.v3) {
- builder.header(ODATA_SERVICE_VERSION, version.getVersion() + ";");
+ builder.header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version.getVersion() + ";");
}
if (StringUtils.isNotBlank(etag)) {
@@ -426,7 +430,7 @@ public abstract class AbstractUtilities {
final Response.ResponseBuilder builder = Response.serverError();
if (version == ODataVersion.v3) {
- builder.header(ODATA_SERVICE_VERSION, version.getVersion() + ";");
+ builder.header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version + ";");
}
final String ext;
@@ -612,7 +616,7 @@ public abstract class AbstractUtilities {
final String basePath =
entitySetName + File.separatorChar + Commons.getEntityKey(entityId) + File.separatorChar
- + LINKS_FILE_PATH + File.separatorChar;
+ + Constants.get(version, ConstantKey.LINKS_FILE_PATH) + File.separatorChar;
final LinkInfo linkInfo = new LinkInfo(fsManager.readFile(basePath + linkName, accept));
linkInfo.setEtag(Commons.getETag(basePath, version));
@@ -631,7 +635,8 @@ public abstract class AbstractUtilities {
final String entitySetName, final String entityId, final String name, final InputStream value)
throws IOException {
final FileObject fo = fsManager.putInMemory(value, fsManager.getAbsolutePath(
- Commons.getEntityBasePath(entitySetName, entityId) + (name == null ? MEDIA_CONTENT_FILENAME : name), null));
+ Commons.getEntityBasePath(entitySetName, entityId)
+ + (name == null ? Constants.get(version, ConstantKey.MEDIA_CONTENT_FILENAME) : name), null));
return fo.getContent().getInputStream();
}
@@ -644,7 +649,7 @@ public abstract class AbstractUtilities {
final String entitySetName, final String entityId, final String name) {
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
return new SimpleEntry<String, InputStream>(basePath, fsManager.readFile(basePath
- + (name == null ? MEDIA_CONTENT_FILENAME : name)));
+ + (name == null ? Constants.get(version, ConstantKey.MEDIA_CONTENT_FILENAME) : name)));
}
public Map.Entry<String, InputStream> readEntity(
@@ -654,7 +659,8 @@ public abstract class AbstractUtilities {
}
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
- return new SimpleEntry<String, InputStream>(basePath, fsManager.readFile(basePath + ENTITY, accept));
+ return new SimpleEntry<String, InputStream>(basePath,
+ fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), accept));
}
public InputStream expandEntity(
@@ -719,15 +725,16 @@ public abstract class AbstractUtilities {
? Accept.XML : accept.getExtension().equals(Accept.JSON.getExtension()) ? Accept.JSON_FULLMETA : accept;
// read atom
- InputStream stream = fsManager.readFile(basePath + ENTITY, acceptType);
+ InputStream stream = fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
// change atom
stream = replaceProperty(stream, changes, path, justValue);
// save atom
- fsManager.putInMemory(stream, fsManager.getAbsolutePath(basePath + ENTITY, acceptType));
+ fsManager.putInMemory(stream,
+ fsManager.getAbsolutePath(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType));
- return fsManager.readFile(basePath + ENTITY, acceptType);
+ return fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
}
public InputStream deleteProperty(
@@ -741,15 +748,16 @@ public abstract class AbstractUtilities {
? Accept.XML : accept.getExtension().equals(Accept.JSON.getExtension()) ? Accept.JSON_FULLMETA : accept;
// read atom
- InputStream stream = fsManager.readFile(basePath + ENTITY, acceptType);
+ InputStream stream = fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
// change atom
stream = deleteProperty(stream, path);
// save atom
- fsManager.putInMemory(stream, fsManager.getAbsolutePath(basePath + ENTITY, acceptType));
+ fsManager.putInMemory(stream,
+ fsManager.getAbsolutePath(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType));
- return fsManager.readFile(basePath + ENTITY, acceptType);
+ return fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
}
public abstract InputStream readEntities(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
index cef564a..e811388 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.fit.utils;
-import static org.apache.olingo.fit.utils.Constants.*;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -154,13 +152,16 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
attributes.add(eventFactory.createAttribute(new QName("title"), link));
attributes.add(eventFactory.createAttribute(new QName("href"),
Commons.getLinksURI(version, entitySetName, entitykey, link)));
- attributes.add(eventFactory.createAttribute(new QName("rel"), Constants.ATOM_LINK_REL + link));
+ attributes.add(eventFactory.createAttribute(new QName("rel"),
+ Constants.get(version, ConstantKey.ATOM_LINK_REL) + link));
attributes.add(eventFactory.createAttribute(new QName("type"),
- Commons.linkInfo.get(version).isFeed(entitySetName, link) ? Constants.ATOM_LINK_FEED
- : Constants.ATOM_LINK_ENTRY));
+ Commons.linkInfo.get(version).isFeed(entitySetName, link)
+ ? Constants.get(version, ConstantKey.ATOM_LINK_FEED)
+ : Constants.get(version, ConstantKey.ATOM_LINK_ENTRY)));
- writer.add(eventFactory.createStartElement(new QName(LINK), attributes.iterator(), null));
- writer.add(eventFactory.createEndElement(new QName(LINK), null));
+ writer.add(eventFactory.createStartElement(
+ new QName(Constants.get(version, ConstantKey.LINK)), attributes.iterator(), null));
+ writer.add(eventFactory.createEndElement(new QName(Constants.get(version, ConstantKey.LINK)), null));
}
writer.add(entry.getValue().getContentReader());
@@ -190,7 +191,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
while (true) {
final Map.Entry<Integer, XmlElement> linkInfo =
- extractElement(reader, null, Collections.<String>singletonList(LINK), startDepth, 2, 2);
+ extractElement(reader, null,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)), startDepth, 2, 2);
startDepth = linkInfo.getKey();
@@ -228,7 +230,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
while (true) {
// a. search for link with type attribute equals to "application/atom+xml;type=entry/feed"
final Map.Entry<Integer, XmlElement> linkInfo = extractElement(
- reader, null, Collections.<String>singletonList(LINK), filter, true, startDepth, 2, 2);
+ reader, null, Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
+ filter, true, startDepth, 2, 2);
final XmlElement link = linkInfo.getValue();
startDepth = linkInfo.getKey();
@@ -239,7 +242,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
try {
final XmlElement inlineElement =
- extractElement(link.getContentReader(), null, Collections.<String>singletonList(INLINE), 0, -1, -1).
+ extractElement(link.getContentReader(), null,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.INLINE)), 0, -1, -1).
getValue();
final XMLEventReader inlineReader = inlineElement.getContentReader();
@@ -307,7 +311,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
while (true) {
// a. search for link with type attribute equals to "application/atom+xml;type=entry/feed"
linkInfo = extractElement(
- reader, writer, Collections.<String>singletonList(LINK), filter, true,
+ reader, writer,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)), filter, true,
linkInfo == null ? 0 : linkInfo.getKey(), 2, 2);
final XmlElement link = linkInfo.getValue();
@@ -342,7 +347,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final InputStream content = addEditLink(
new ByteArrayInputStream(tmpBos.toByteArray()),
entitySetName,
- Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")");
+ Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")");
// -----------------------------------------
// -----------------------------------------
@@ -351,7 +356,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
return addAtomContent(
content,
entitySetName,
- Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")");
+ Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")");
// -----------------------------------------
}
@@ -439,7 +444,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
try {
// check edit link existence
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ extractElement(reader, writer, Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
Collections.<Map.Entry<String, String>>singletonList(
new AbstractMap.SimpleEntry<String, String>("rel", "edit")), false, 0, -1, -1);
@@ -518,7 +523,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
} else {
try {
final XmlElement entryElement =
- extractElement(reader, writer, Collections.<String>singletonList(PROPERTIES), 0, 2, 3).getValue();
+ extractElement(reader, writer, Collections.<String>singletonList(
+ Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3).getValue();
addAtomElement(
IOUtils.toInputStream("<content type=\"application/xml\">"),
@@ -564,9 +570,11 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
public int countAllElements(final String entitySetName) throws Exception {
final String basePath = entitySetName + File.separatorChar;
- int count = countFeedElements(fsManager.readFile(basePath + FEED, Accept.XML), "entry");
+ int count = countFeedElements(fsManager.readFile(basePath + Constants.get(version, ConstantKey.FEED), Accept.XML),
+ "entry");
- final String skipTokenDirPath = fsManager.getAbsolutePath(basePath + SKIP_TOKEN, null);
+ final String skipTokenDirPath = fsManager.getAbsolutePath(basePath + Constants.get(version, ConstantKey.SKIP_TOKEN),
+ null);
try {
@@ -575,7 +583,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
for (FileObject file : files) {
count += countFeedElements(fsManager.readFile(
- basePath + SKIP_TOKEN + File.separatorChar + file.getName().getBaseName(), null), "entry");
+ basePath + Constants.get(version, ConstantKey.SKIP_TOKEN) + File.separatorChar
+ + file.getName().getBaseName(), null), "entry");
}
} catch (FileSystemException fse) {
LOG.debug("Resource path '{}' not found", skipTokenDirPath);
@@ -739,7 +748,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final List<String> pathElements = new ArrayList<String>();
for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ pathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final XMLEventReader reader = getEventReader(is);
@@ -770,28 +779,30 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
while (reader.hasNext()) {
final XMLEvent event = reader.nextEvent();
if (event.getEventType() == XMLStreamConstants.START_ELEMENT
- && LINK.equals(event.asStartElement().getName().getLocalPart())
+ && Constants.get(version, ConstantKey.LINK).equals(event.asStartElement().getName().getLocalPart())
&& !fieldToBeSaved.contains(
event.asStartElement().getAttributeByName(new QName("title")).getValue())
&& !"edit".equals(event.asStartElement().getAttributeByName(new QName("rel")).getValue())) {
writeCurrent = false;
} else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
- && LINK.equals(event.asEndElement().getName().getLocalPart())) {
+ && Constants.get(version, ConstantKey.LINK).equals(event.asEndElement().getName().getLocalPart())) {
writeNext = true;
} else if (event.getEventType() == XMLStreamConstants.START_ELEMENT
- && (PROPERTIES).equals(event.asStartElement().getName().getLocalPart())) {
+ && (Constants.get(version, ConstantKey.PROPERTIES)).equals(
+ event.asStartElement().getName().getLocalPart())) {
writeCurrent = true;
writeNext = false;
inProperties = true;
} else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
- && (PROPERTIES).equals(event.asEndElement().getName().getLocalPart())) {
+ && (Constants.get(version, ConstantKey.PROPERTIES)).equals(
+ event.asEndElement().getName().getLocalPart())) {
writeCurrent = true;
} else if (inProperties) {
if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
final String elementName = event.asStartElement().getName().getLocalPart();
for (String propertyName : propertyNames) {
- if ((ATOM_PROPERTY_PREFIX + propertyName.trim()).equals(elementName)) {
+ if ((Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + propertyName.trim()).equals(elementName)) {
writeCurrent = true;
found.remove(propertyName);
currentName = propertyName;
@@ -800,7 +811,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
} else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
&& StringUtils.isNotBlank(currentName)
- && (ATOM_PROPERTY_PREFIX + currentName.trim()).equals(
+ && (Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + currentName.trim()).equals(
event.asEndElement().getName().getLocalPart())) {
writeNext = false;
currentName = null;
@@ -846,13 +857,14 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
// build a feed
bos.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>".getBytes());
- bos.write(("<feed xml:base=\"" + DEFAULT_SERVICE_URL + "\" "
+ bos.write(("<feed xml:base=\"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "\" "
+ "xmlns=\"http://www.w3.org/2005/Atom\" "
+ "xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" "
+ "xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">")
.getBytes());
- bos.write(("<id>" + DEFAULT_SERVICE_URL + "entityset(entityid)/" + linkName + "</id>").getBytes());
+ bos.write(("<id>" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "entityset(entityid)/" + linkName
+ + "</id>").getBytes());
bos.write(("<title type=\"text\">" + linkName + "</title>").getBytes());
bos.write("<updated>2014-03-03T13:40:49Z</updated>".getBytes());
@@ -901,7 +913,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
final Map.Entry<Integer, XmlElement> propertyElement =
- extractElement(reader, null, Collections.<String>singletonList(PROPERTIES), 0, 2, 3);
+ extractElement(reader, null,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3);
reader.close();
reader = propertyElement.getValue().getContentReader();
@@ -924,9 +937,11 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
int pos = 0;
while (true) {
final Map.Entry<Integer, XmlElement> linkElement =
- extractElement(reader, null, Collections.<String>singletonList(LINK), pos, 2, 2);
+ extractElement(reader, null,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)), pos, 2, 2);
- res.put("[LINK]" + linkElement.getValue().getStart().getAttributeByName(new QName("title")).getValue(),
+ res.put("[Constants.get(version, ConstantKey.LINK)]"
+ + linkElement.getValue().getStart().getAttributeByName(new QName("title")).getValue(),
linkElement.getValue().toStream());
pos = linkElement.getKey();
@@ -952,7 +967,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
// add property changes
// ---------------------------------
Map.Entry<Integer, XmlElement> propertyElement =
- extractElement(reader, writer, Collections.<String>singletonList(PROPERTIES), 0, 2, 3);
+ extractElement(reader, writer,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3);
writer.flush();
@@ -981,7 +997,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
}
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
- if (!remains.getKey().startsWith("[LINK]")) {
+ if (!remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
pwriter.append(IOUtils.toString(remains.getValue()));
IOUtils.closeQuietly(remains.getValue());
}
@@ -1009,7 +1025,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
// remove existent links
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
- if (remains.getKey().startsWith("[LINK]")) {
+ if (remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
bos.reset();
@@ -1018,7 +1034,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
try {
final String linkName = remains.getKey().substring(remains.getKey().indexOf("]") + 1);
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ extractElement(reader, writer, Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>("title", linkName)),
false, 0, 2, 2);
@@ -1038,14 +1054,15 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
bos.reset();
writer = getEventWriter(bos);
- propertyElement = extractElement(reader, writer, Collections.<String>singletonList(CONTENT), 0, 2, 2);
+ propertyElement = extractElement(reader, writer,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.CONTENT)), 0, 2, 2);
writer.flush();
pbos.reset();
pwriter = new OutputStreamWriter(pbos);
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
- if (remains.getKey().startsWith("[LINK]")) {
+ if (remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
pwriter.append(IOUtils.toString(remains.getValue()));
IOUtils.closeQuietly(remains.getValue());
}
@@ -1084,7 +1101,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
try {
final XmlElement linkElement =
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ extractElement(reader, writer,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
Collections.<Map.Entry<String, String>>singletonList(new SimpleEntry<String, String>("title", linkName)),
false, 0, -1, -1).getValue();
writer.add(linkElement.getStart());
@@ -1116,23 +1134,26 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
public String getEdmTypeFromAtom(final String entitySetName, final String entityId, final List<String> path)
throws Exception {
- InputStream src = fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.XML);
+ InputStream src = fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId)
+ + Constants.get(version, ConstantKey.ENTITY), Accept.XML);
final List<String> atomPathElements = new ArrayList<String>();
for (String element : path) {
- atomPathElements.add(ATOM_PROPERTY_PREFIX + element);
+ atomPathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final Map.Entry<Integer, XmlElement> prop = extractElement(getEventReader(src), null, atomPathElements, 0, 3, 4);
IOUtils.closeQuietly(src);
- final Attribute type = prop.getValue().getStart().getAttributeByName(new QName(TYPE));
+
+ final Attribute type =
+ prop.getValue().getStart().getAttributeByName(new QName(Constants.get(version, ConstantKey.TYPE)));
final String edmType;
if (type == null) {
- edmType = Constants.ATOM_DEF_TYPE;
+ edmType = Constants.get(version, ConstantKey.ATOM_DEF_TYPE);
} else {
edmType = type.getValue();
}
@@ -1189,11 +1210,12 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final List<String> pathElements = new ArrayList<String>();
for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ pathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final InputStream src =
- fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.XML);
+ fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId)
+ + Constants.get(version, ConstantKey.ENTITY), Accept.XML);
final XMLEventReader reader = getEventReader(src);
final XmlElement property = extractElement(reader, null, pathElements, 0, 3, 4).getValue();
@@ -1208,21 +1230,17 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
writer.add(eventFactory.createStartDocument("UTF-8", "1.0"));
writer.add(property.getStart());
- if (version == ODataVersion.v4) {
-
- if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), V4_DATASERVICES_NS));
- }
- if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), V4_METADATA_NS));
- }
- } else {
- if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), V3_DATASERVICES_NS));
- }
- if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), V3_METADATA_NS));
- }
+ if (property.getStart().getAttributeByName(new QName(
+ Constants.get(version, ConstantKey.ATOM_DATASERVICE_NS))) == null) {
+ writer.add(eventFactory.createNamespace(
+ Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX).substring(0, 1),
+ Constants.get(version, ConstantKey.DATASERVICES_NS)));
+ }
+ if (property.getStart().getAttributeByName(new QName(
+ Constants.get(version, ConstantKey.ATOM_METADATA_NS))) == null) {
+ writer.add(eventFactory.createNamespace(
+ Constants.get(version, ConstantKey.ATOM_METADATA_PREFIX).substring(0, 1),
+ Constants.get(version, ConstantKey.METADATA_NS)));
}
writer.add(property.getContentReader());
@@ -1242,7 +1260,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final List<String> pathElements = new ArrayList<String>();
for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ pathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final XMLEventReader reader = getEventReader(src);
@@ -1258,7 +1276,16 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final XMLEventReader changesReader = new XMLEventReaderWrapper(replacement);
- writer.add(changesReader);
+ while (changesReader.hasNext()) {
+ final XMLEvent event = changesReader.nextEvent();
+ if (event.isStartElement() && event.asStartElement().getName().equals(element.getValue().getStart().getName())) {
+ writer.add(element.getValue().getStart());
+ writer.add(changesReader);
+ } else {
+ writer.add(event);
+ }
+ }
+
changesReader.close();
IOUtils.closeQuietly(replacement);
@@ -1283,7 +1310,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final List<String> pathElements = new ArrayList<String>();
for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ pathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final XMLEventReader reader = getEventReader(src);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
index 4cf992a..c0031f1 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.fit.utils;
-import static org.apache.olingo.fit.utils.Constants.*;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -113,7 +111,8 @@ public abstract class Commons {
throws IOException {
try {
return FSManager.instance(version)
- .getAbsolutePath(basePath + LINKS_FILE_PATH + File.separatorChar + linkName, accept);
+ .getAbsolutePath(basePath + Constants.get(version, ConstantKey.LINKS_FILE_PATH)
+ + File.separatorChar + linkName, accept);
} catch (Exception e) {
throw new IOException(e);
}
@@ -147,7 +146,7 @@ public abstract class Commons {
if (URI.create(uri).isAbsolute()) {
builder.append(uri);
} else {
- builder.append(DEFAULT_SERVICE_URL).append(uri);
+ builder.append(Constants.get(ConstantKey.DEFAULT_SERVICE_URL)).append(uri);
}
builder.append("</uri>");
}
@@ -162,8 +161,8 @@ public abstract class Commons {
throws IOException {
final ObjectNode links = new ObjectNode(JsonNodeFactory.instance);
links.put(
- JSON_ODATAMETADATA_NAME,
- ODATA_METADATA_PREFIX + entitySetName + "/$links/" + link.getKey());
+ Constants.get(ConstantKey.JSON_ODATAMETADATA_NAME),
+ Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + entitySetName + "/$links/" + link.getKey());
final ArrayNode uris = new ArrayNode(JsonNodeFactory.instance);
@@ -172,7 +171,7 @@ public abstract class Commons {
if (URI.create(uri).isAbsolute()) {
absoluteURI = uri;
} else {
- absoluteURI = DEFAULT_SERVICE_URL + uri;
+ absoluteURI = Constants.get(ConstantKey.DEFAULT_SERVICE_URL) + uri;
}
uris.add(new ObjectNode(JsonNodeFactory.instance).put("url", absoluteURI));
}
@@ -214,20 +213,20 @@ public abstract class Commons {
switch (target) {
case JSON_NOMETA:
// nometa + minimal
- toBeRemoved.add(JSON_ODATAMETADATA_NAME);
+ toBeRemoved.add(Constants.get(ConstantKey.JSON_ODATAMETADATA_NAME));
case JSON:
// minimal
- toBeRemoved.add(JSON_EDITLINK_NAME);
- toBeRemoved.add(JSON_ID_NAME);
- toBeRemoved.add(JSON_TYPE_NAME);
+ toBeRemoved.add(Constants.get(ConstantKey.JSON_EDITLINK_NAME));
+ toBeRemoved.add(Constants.get(ConstantKey.JSON_ID_NAME));
+ toBeRemoved.add(Constants.get(ConstantKey.JSON_TYPE_NAME));
final Iterator<Map.Entry<String, JsonNode>> fields = node.fields();
while (fields.hasNext()) {
final Map.Entry<String, JsonNode> field = fields.next();
- if (field.getKey().endsWith(JSON_MEDIA_SUFFIX)
- || field.getKey().endsWith(JSON_NAVIGATION_SUFFIX)
- || field.getKey().endsWith(JSON_TYPE_SUFFIX)) {
+ if (field.getKey().endsWith(Constants.get(ConstantKey.JSON_MEDIA_SUFFIX))
+ || field.getKey().endsWith(Constants.get(ConstantKey.JSON_NAVIGATION_SUFFIX))
+ || field.getKey().endsWith(Constants.get(ConstantKey.JSON_TYPE_SUFFIX))) {
toBeRemoved.add(field.getKey());
} else if (field.getValue().isObject()) {
toBeReplaced.put(field.getKey(), changeFormat((ObjectNode) field.getValue(), target));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java b/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java
new file mode 100644
index 0000000..3c46e94
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java
@@ -0,0 +1,67 @@
+/*
+ * 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.utils;
+
+public enum ConstantKey {
+
+ ODATA_SERVICE_VERSION,
+ DEFAULT_SERVICE_URL,
+ ODATA_COUNT_NAME,
+ ODATA_METADATA_PREFIX,
+ ATOM_DEF_TYPE,
+ ATOM_PROPERTY_PREFIX,
+ ATOM_METADATA_PREFIX,
+ ATOM_METADATA_NS,
+ ATOM_DATASERVICE_NS,
+ ATOM_LINK_ENTRY,
+ ATOM_LINK_FEED,
+ ATOM_LINK_REL,
+ TYPE,
+ INLINE_LOCAL,
+ INLINE_FILE_PATH,
+ LINKS_FILE_PATH,
+ INLINE,
+ CONTENT,
+ PROPERTIES,
+ LINK,
+ DATASERVICES_NS,
+ METADATA_NS,
+ METADATA,
+ SERVICES,
+ FEED,
+ ENTITY,
+ REF,
+ MEDIA_CONTENT_FILENAME,
+ SKIP_TOKEN,
+ FILTER,
+ ORDERBY,
+ JSON_VALUE_NAME,
+ JSON_NEXTLINK_NAME,
+ JSON_NEXTLINK_SUFFIX,
+ JSON_ODATAMETADATA_NAME,
+ JSON_NAVIGATION_BIND_SUFFIX,
+ JSON_NAVIGATION_SUFFIX,
+ JSON_MEDIA_SUFFIX,
+ JSON_TYPE_NAME,
+ JSON_TYPE_SUFFIX,
+ JSON_ID_NAME,
+ JSON_EDITLINK_NAME,
+ XHTTP_HEADER_NAME;
+
+};
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
index be522d9..ffd52bc 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
@@ -18,96 +18,83 @@
*/
package org.apache.olingo.fit.utils;
-public class Constants {
-
- public final static String ODATA_SERVICE_VERSION = "DataServiceVersion";
-
- public final static String DEFAULT_SERVICE_URL = "http://localhost:9080/StaticService/V30/Static.svc/";
-
- public final static String ODATA_COUNT_NAME = "odata.count";
-
- public final static String ODATA_METADATA_PREFIX = DEFAULT_SERVICE_URL + "$metadata#";
-
- public final static String ATOM_DEF_TYPE = "Edm.String";
-
- public final static String ATOM_PROPERTY_PREFIX = "d:";
-
- public final static String ATOM_METADATA_PREFIX = "m:";
-
- public final static String ATOM_METADATA_NS = "xmlns:m";
-
- public final static String ATOM_DATASERVICE_NS = "xmlns:d";
-
- public final static String ATOM_LINK_ENTRY = "application/atom+xml;type=entry";
-
- public final static String ATOM_LINK_FEED = "application/atom+xml;type=feed";
-
- public final static String ATOM_LINK_REL = "http://schemas.microsoft.com/ado/2007/08/dataservices/related/";
-
- public final static String TYPE = ATOM_METADATA_PREFIX + "type";
-
- public final static String INLINE_LOCAL = "inline";
-
- public final static String INLINE_FILE_PATH = "inline";
-
- public final static String LINKS_FILE_PATH = "links";
-
- public final static String INLINE = ATOM_METADATA_PREFIX + INLINE_LOCAL;
-
- public final static String CONTENT = "content";
-
- public final static String PROPERTIES = ATOM_METADATA_PREFIX + "properties";
-
- public final static String LINK = "link";
-
- public final static String V3_DATASERVICES_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices";
-
- public final static String V4_DATASERVICES_NS = "http://docs.oasis-open.org/odata/ns/dataservices";
+import java.util.EnumMap;
+import java.util.Map;
- public final static String V3_METADATA_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
-
- public final static String V4_METADATA_NS = "http://docs.oasis-open.org/odata/ns/metadata";
-
- public final static String METADATA = "metadata";
-
- public final static String SERVICES = "services";
-
- public final static String FEED = "feed";
-
- public final static String ENTITY = "entity";
-
- public final static String REF = "references";
-
- public final static String MEDIA_CONTENT_FILENAME = "$value.bin";
-
- public final static String SKIP_TOKEN = "skiptoken";
-
- public final static String FILTER = "filter";
-
- public final static String ORDERBY = "orderby";
-
- public final static String JSON_VALUE_NAME = "value";
-
- public final static String JSON_NEXTLINK_NAME = "odata.nextLink";
-
- public final static String JSON_NEXTLINK_SUFFIX = "@" + JSON_NEXTLINK_NAME;
-
- public final static String JSON_ODATAMETADATA_NAME = "odata.metadata";
-
- public final static String JSON_NAVIGATION_BIND_SUFFIX = "@odata.bind";
-
- public final static String JSON_NAVIGATION_SUFFIX = "@odata.navigationLinkUrl";
-
- public final static String JSON_MEDIA_SUFFIX = "@odata.mediaEditLink";
-
- public final static String JSON_TYPE_NAME = "odata.type";
-
- public final static String JSON_TYPE_SUFFIX = "@" + JSON_TYPE_NAME;
-
- public final static String JSON_ID_NAME = "odata.id";
-
- public final static String JSON_EDITLINK_NAME = "odata.editLink";
-
- public final static String XHTTP_HEADER_NAME = "X-HTTP-METHOD";
+public class Constants {
+ private final static Map<ConstantKey, String> v4constants = new EnumMap<ConstantKey, String>(ConstantKey.class);
+
+ private final static Map<ConstantKey, String> constants = new EnumMap<ConstantKey, String>(ConstantKey.class);
+
+ static {
+
+ // -----------------------------
+ // V4 only
+ // -----------------------------
+ v4constants.put(ConstantKey.JSON_NAVIGATION_SUFFIX, "@odata.navigationLink");
+ v4constants.put(ConstantKey.DATASERVICES_NS, "http://docs.oasis-open.org/odata/ns/dataservices");
+ v4constants.put(ConstantKey.METADATA_NS, "http://docs.oasis-open.org/odata/ns/metadata");
+ v4constants.put(ConstantKey.ODATA_SERVICE_VERSION, "OData-Version");
+ v4constants.put(ConstantKey.DEFAULT_SERVICE_URL, "http://localhost:9080/StaticService/V40/Static.svc/");
+ v4constants.put(ConstantKey.ODATA_METADATA_PREFIX, "http://localhost:9080/StaticService/V40/Static.svc/$metadata#");
+ // -----------------------------
+
+ // -----------------------------
+ // V3 and defaults
+ // -----------------------------
+ constants.put(ConstantKey.ODATA_SERVICE_VERSION, "DataServiceVersion");
+ constants.put(ConstantKey.DEFAULT_SERVICE_URL, "http://localhost:9080/StaticService/V30/Static.svc/");
+ constants.put(ConstantKey.ODATA_COUNT_NAME, "odata.count");
+ constants.put(ConstantKey.ODATA_METADATA_PREFIX, "http://localhost:9080/StaticService/V30/Static.svc/$metadata#");
+ constants.put(ConstantKey.ATOM_DEF_TYPE, "Edm.String");
+ constants.put(ConstantKey.ATOM_PROPERTY_PREFIX, "d:");
+ constants.put(ConstantKey.ATOM_METADATA_PREFIX, "m:");
+ constants.put(ConstantKey.ATOM_METADATA_NS, "xmlns:m");
+ constants.put(ConstantKey.ATOM_DATASERVICE_NS, "xmlns:d");
+ constants.put(ConstantKey.ATOM_LINK_ENTRY, "application/atom+xml;type=entry");
+ constants.put(ConstantKey.ATOM_LINK_FEED, "application/atom+xml;type=feed");
+ constants.put(ConstantKey.ATOM_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/related/");
+ constants.put(ConstantKey.TYPE, "m:type");
+ constants.put(ConstantKey.INLINE_LOCAL, "inline");
+ constants.put(ConstantKey.INLINE_FILE_PATH, "inline");
+ constants.put(ConstantKey.LINKS_FILE_PATH, "links");
+ constants.put(ConstantKey.INLINE, "m:inline");
+ constants.put(ConstantKey.CONTENT, "content");
+ constants.put(ConstantKey.PROPERTIES, "m:properties");
+ constants.put(ConstantKey.LINK, "link");
+ constants.put(ConstantKey.METADATA_NS, "http://schemas.microsoft.com/ado/2007/08/dataservices/metadta");
+ constants.put(ConstantKey.DATASERVICES_NS, "http://schemas.microsoft.com/ado/2007/08/dataservices");
+ constants.put(ConstantKey.METADATA, "metadata");
+ constants.put(ConstantKey.SERVICES, "services");
+ constants.put(ConstantKey.FEED, "feed");
+ constants.put(ConstantKey.ENTITY, "entity");
+ constants.put(ConstantKey.REF, "references");
+ constants.put(ConstantKey.MEDIA_CONTENT_FILENAME, "$value.bin");
+ constants.put(ConstantKey.SKIP_TOKEN, "skiptoken");
+ constants.put(ConstantKey.FILTER, "filter");
+ constants.put(ConstantKey.ORDERBY, "orderby");
+ constants.put(ConstantKey.JSON_VALUE_NAME, "value");
+ constants.put(ConstantKey.JSON_NEXTLINK_NAME, "odata.nextLink");
+ constants.put(ConstantKey.JSON_NEXTLINK_SUFFIX, "@odata.nextLink");
+ constants.put(ConstantKey.JSON_ODATAMETADATA_NAME, "odata.metadata");
+ constants.put(ConstantKey.JSON_NAVIGATION_BIND_SUFFIX, "@odata.bind");
+ constants.put(ConstantKey.JSON_NAVIGATION_SUFFIX, "@odata.navigationLinkUrl");
+ constants.put(ConstantKey.JSON_MEDIA_SUFFIX, "@odata.mediaEditLink");
+ constants.put(ConstantKey.JSON_TYPE_NAME, "odata.type");
+ constants.put(ConstantKey.JSON_TYPE_SUFFIX, "@odata.type");
+ constants.put(ConstantKey.JSON_ID_NAME, "odata.id");
+ constants.put(ConstantKey.JSON_EDITLINK_NAME, "odata.editLink");
+ constants.put(ConstantKey.XHTTP_HEADER_NAME, "X-HTTP-METHOD");
+ // -----------------------------
+ }
+
+ public static String get(final ConstantKey key) {
+ return get(null, key);
+ }
+
+ public static String get(final ODataVersion version, final ConstantKey key) {
+ return (version == null || version == ODataVersion.v3 || !v4constants.containsKey(key)
+ ? constants : v4constants).get(key);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java b/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java
index 863bbd1..5b35d4d 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java
@@ -32,4 +32,4 @@ public enum ODataVersion {
public String getVersion() {
return version;
}
-};
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java b/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java
index 46fbd27..bbcc489 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java
@@ -36,8 +36,9 @@ public class XHTTPMethodInterceptor extends AbstractPhaseInterceptor<Message> {
@SuppressWarnings("unchecked")
final Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
- if (headers.containsKey(Constants.XHTTP_HEADER_NAME)) {
- message.put(Message.HTTP_REQUEST_METHOD, headers.get(Constants.XHTTP_HEADER_NAME).iterator().next());
+ if (headers.containsKey(Constants.get(ConstantKey.XHTTP_HEADER_NAME))) {
+ message.put(Message.HTTP_REQUEST_METHOD, headers.get(Constants.get(ConstantKey.XHTTP_HEADER_NAME))
+ .iterator().next());
}
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
index c1a58bf..919cee6 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
@@ -32,6 +32,7 @@ import javax.xml.stream.events.StartElement;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.fit.utils.Accept;
import org.apache.olingo.fit.utils.Commons;
+import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.MetadataLinkInfo;
import org.apache.olingo.fit.utils.ODataVersion;
@@ -49,7 +50,7 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
final MetadataLinkInfo metadataLinkInfo = new MetadataLinkInfo();
Commons.getLinkInfo().put(version, metadataLinkInfo);
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final InputStream metadata = fsManager.readFile(Constants.get(version, ConstantKey.METADATA), Accept.XML);
final XMLEventReader reader = getEventReader(metadata);
try {
@@ -69,7 +70,7 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
private void retrieveLinks(final XmlElement entitySetElement, final MetadataLinkInfo metadataLinkInfo)
throws Exception {
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final InputStream metadata = fsManager.readFile(Constants.get(version, ConstantKey.METADATA), Accept.XML);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(metadata, bos);
@@ -120,7 +121,7 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
private Map.Entry<String, Boolean> getTargetInfo(final StartElement element, final String linkName)
throws Exception {
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final InputStream metadata = fsManager.readFile(Constants.get(version, ConstantKey.METADATA), Accept.XML);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(metadata, bos);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
index 1cf8d38..77c46be 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
@@ -30,6 +30,7 @@ import javax.xml.stream.XMLEventReader;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.fit.utils.Accept;
import org.apache.olingo.fit.utils.Commons;
+import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.MetadataLinkInfo;
import org.apache.olingo.fit.utils.ODataVersion;
@@ -47,7 +48,7 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
final MetadataLinkInfo metadataLinkInfo = new MetadataLinkInfo();
Commons.getLinkInfo().put(version, metadataLinkInfo);
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final InputStream metadata = fsManager.readFile(Constants.get(version, ConstantKey.METADATA), Accept.XML);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(metadata, bos);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java
index d545567..a6deb49 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java
@@ -38,20 +38,6 @@ public interface ServiceDocument {
URI getBaseURI();
/**
- * Returns metadata context.
- *
- * @return metadata context
- */
- String getMetadataContext();
-
- /**
- * Returns metadata ETag.
- *
- * @return metadata ETag
- */
- String getMetadataETag();
-
- /**
* Gets top level entity sets.
*
* @return top level entity sets.
@@ -134,5 +120,4 @@ public interface ServiceDocument {
* @return related service document with given title if found, otherwise null
*/
ServiceDocumentItem getRelatedServiceDocumentByTitle(String title);
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
index 7878805..e8f5ae3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -88,7 +88,7 @@ public class ODataPropertyRequestImpl<T extends CommonODataProperty>
try {
final Container<Property> container =
odataClient.getDeserializer().toProperty(
- res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
+ res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
property = (T) odataClient.getBinder().getODataProperty(extractFromContainer(container));
} catch (IOException e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
index 57ba0ef..83b3a12 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.data;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -28,6 +29,7 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
+import org.apache.olingo.commons.api.Constants;
public abstract class AbstractServiceDocument implements ServiceDocument {
@@ -35,14 +37,35 @@ public abstract class AbstractServiceDocument implements ServiceDocument {
private final List<ServiceDocumentItem> entitySets = new ArrayList<ServiceDocumentItem>();
+ private String metadata;
+
@Override
- public String getMetadataContext() {
- return null;
+ public URI getBaseURI() {
+ URI baseURI = null;
+ if (metadata != null) {
+ final String metadataURI = getMetadata();
+ baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
+ }
+
+ return baseURI;
}
- @Override
- public String getMetadataETag() {
- return null;
+ /**
+ * Gets the metadata URI.
+ *
+ * @return the metadata URI
+ */
+ public String getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata URI.
+ *
+ * @param metadata metadata URI.
+ */
+ public void setMetadata(final String metadata) {
+ this.metadata = metadata;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
index 8594f90..f949e16 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
@@ -25,17 +25,20 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
+import java.net.URI;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.data.ODataJacksonDeserializer;
-public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<AbstractServiceDocument> {
+public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Container<AbstractServiceDocument>> {
@Override
- protected AbstractServiceDocument doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<AbstractServiceDocument> doDeserialize(
+ final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
@@ -44,19 +47,28 @@ public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Ab
? new org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl()
: new org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl();
- if (tree.hasNonNull(Constants.JSON_METADATA)
- && serviceDocument instanceof org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl) {
+ final String metadataETag;
+ final URI contextURL;
- ((org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl) serviceDocument).
- setMetadata(tree.get(Constants.JSON_METADATA).textValue());
+ if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
+ metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
+ tree.remove(Constants.JSON_METADATA_ETAG);
+ } else {
+ metadataETag = null;
}
- if (tree.hasNonNull(Constants.JSON_CONTEXT)
- && serviceDocument instanceof org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl) {
- ((org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl) serviceDocument).
- setMetadataContext(tree.get(Constants.JSON_CONTEXT).textValue());
+ if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
+ contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
+ tree.remove(Constants.JSON_CONTEXT);
+ } else if (tree.hasNonNull(Constants.JSON_METADATA)) {
+ contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
+ tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
}
+ serviceDocument.setMetadata(contextURL == null ? null : contextURL.toASCIIString());
+
for (final Iterator<JsonNode> itor = tree.get(Constants.VALUE).elements(); itor.hasNext();) {
final JsonNode node = itor.next();
@@ -79,7 +91,6 @@ public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Ab
}
}
- return serviceDocument;
+ return new Container<AbstractServiceDocument>(contextURL, metadataETag, serviceDocument);
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
index ef62f13..1b18040 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
@@ -29,9 +29,11 @@ import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<ServiceDocument> {
+public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<Container<ServiceDocument>> {
private String getTitle(final JsonParser jp) throws IOException {
String title = jp.nextTextValue();
@@ -67,32 +69,28 @@ public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<Ser
}
@Override
- protected ServiceDocument doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ protected Container<ServiceDocument> doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final AbstractServiceDocument sdoc = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl()
: new org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl();
+ URI contextURL = null;
+ String metadataETag = null;
+ String base = null;
+
for (; jp.getCurrentToken() != JsonToken.END_OBJECT
|| !"service".equals(((FromXmlParser) jp).getStaxReader().getLocalName()); jp.nextToken()) {
final JsonToken token = jp.getCurrentToken();
if (token == JsonToken.FIELD_NAME) {
if ("base".equals(jp.getCurrentName())) {
- if (sdoc instanceof org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl) {
- ((org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl) sdoc).
- setBaseURI(URI.create(jp.nextTextValue()));
- } else {
- ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
- setBaseURI(URI.create(jp.nextTextValue()));
- }
+ base = jp.nextTextValue();
} else if ("context".equals(jp.getCurrentName())) {
- ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
- setMetadataContext(jp.nextTextValue());
+ contextURL = URI.create(jp.nextTextValue());
} else if ("metadata-etag".equals(jp.getCurrentName())) {
- ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
- setMetadataETag(jp.nextTextValue());
+ metadataETag = jp.nextTextValue();
} else if ("workspace".equals(jp.getCurrentName())) {
jp.nextToken();
jp.nextToken();
@@ -115,7 +113,12 @@ public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<Ser
}
}
- return sdoc;
- }
+ sdoc.setMetadata((contextURL == null
+ ? URIUtils.getURI(base, "$metadata")
+ : URIUtils.getURI(base, contextURL.toASCIIString())).toASCIIString());
+ return new Container<ServiceDocument>(
+ contextURL == null ? null : URIUtils.getURI(sdoc.getBaseURI(), contextURL),
+ metadataETag, sdoc);
+ }
}
[21/51] [abbrv] git commit: [OLINGO-175] V4 Entity create test
Posted by sk...@apache.org.
[OLINGO-175] V4 Entity create test
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/850d44e0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/850d44e0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/850d44e0
Branch: refs/heads/olingo-206-validator
Commit: 850d44e00ebf4a8e9a588b0cf5a46ae4d4a5fb55
Parents: c73772f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 17:57:31 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 17:57:31 2014 +0200
----------------------------------------------------------------------
.../olingo/fit/utils/AbstractUtilities.java | 13 +++
.../org/apache/olingo/fit/utils/Commons.java | 1 +
.../core/it/v4/EntityCreateTestITCase.java | 84 ++++++++++++++++++++
3 files changed, 98 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/850d44e0/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 5b23366..b4d71b5 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
@@ -511,6 +511,19 @@ public abstract class AbstractUtilities {
}
}
sequence.put(entitySetName, Integer.valueOf(res));
+ } else if ("Orders".equals(entitySetName)) {
+ try {
+ final Map<String, InputStream> value =
+ getPropertyValues(entity, Collections.<String>singletonList("OrderID"));
+ res = value.isEmpty() ? null : IOUtils.toString(value.values().iterator().next());
+ } catch (Exception e) {
+ if (sequence.containsKey(entitySetName)) {
+ res = String.valueOf(sequence.get(entitySetName) + 1);
+ } else {
+ throw new Exception(String.format("Unable to retrieve entity key value for %s", entitySetName));
+ }
+ }
+ sequence.put(entitySetName, Integer.valueOf(res));
} else if ("Customer".equals(entitySetName)) {
try {
final Map<String, InputStream> value =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/850d44e0/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
index c0031f1..a1c658a 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
@@ -67,6 +67,7 @@ public abstract class Commons {
sequence.put("Order", 1000);
sequence.put("ComputerDetail", 1000);
sequence.put("AllGeoTypesSet", 1000);
+ sequence.put("Orders", 1000);
mediaContent.put("CustomerInfo", "CustomerinfoId");
mediaContent.put("Car", "VIN");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/850d44e0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
new file mode 100644
index 0000000..0044e73
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.it.v4;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.core.domain.v3.ODataCollectionValueImpl;
+import org.apache.olingo.commons.core.domain.v4.ODataEntityImpl;
+import org.junit.Test;
+
+public class EntityCreateTestITCase extends AbstractTestITCase {
+
+ private void createOrder(final ODataPubFormat format, final int id) {
+ final ODataEntity order = new ODataEntityImpl("Microsoft.Test.OData.Services.ODataWCFService.Order");
+
+ final ODataProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Int32).setValue(id).build());
+ order.getProperties().add(orderId);
+
+ final ODataProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("2011-03-04T16:03:57Z").build());
+ order.getProperties().add(orderDate);
+
+ final ODataProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000001S").build());
+ order.getProperties().add(shelfLife);
+
+ // TODO: this should be possible via getClient().getObjectFactory().newCollectionValue()
+ final ODataCollectionValue<ODataValue> orderShelfLifesValue =
+ new ODataCollectionValueImpl("Collection(Duration)");
+ orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000001S").build());
+ orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build());
+ final ODataProperty orderShelfLifes = getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
+ orderShelfLifesValue);
+ order.getProperties().add(orderShelfLifes);
+
+ final ODataEntityCreateRequest<ODataEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
+ getClient().getURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Orders").build(), order);
+ req.setFormat(format);
+ final ODataEntity created = req.execute().getBody();
+ assertNotNull(created);
+ assertEquals(2, created.getProperty("OrderShelfLifes").getCollectionValue().size());
+ }
+
+ @Test
+ public void atom() {
+ createOrder(ODataPubFormat.ATOM, 1000);
+ }
+
+ @Test
+ public void json() {
+ createOrder(ODataPubFormat.JSON, 1001);
+ }
+}
[08/51] [abbrv] git commit: [OLINGO-200] Introducing specialization
for V3 and V4 domain objects
Posted by sk...@apache.org.
[OLINGO-200] Introducing specialization for V3 and V4 domain objects
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/80e5ed56
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/80e5ed56
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/80e5ed56
Branch: refs/heads/olingo-206-validator
Commit: 80e5ed56d55f46e2bf5eb5933145ab5ef66ea694
Parents: ceda474
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 16:55:41 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 16:55:41 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonODataClient.java | 4 +-
.../request/cud/CommonCUDRequestFactory.java | 18 +-
.../retrieve/CommonRetrieveRequestFactory.java | 12 +-
.../request/retrieve/ODataEntityRequest.java | 4 +-
.../request/retrieve/ODataEntitySetRequest.java | 5 +-
.../request/retrieve/ODataPropertyRequest.java | 4 +-
.../retrieve/v3/RetrieveRequestFactory.java | 18 +
.../retrieve/v4/RetrieveRequestFactory.java | 17 +
.../response/ODataEntityCreateResponse.java | 4 +-
.../response/ODataEntityUpdateResponse.java | 4 +-
.../ODataMediaEntityCreateResponse.java | 4 +-
.../ODataMediaEntityUpdateResponse.java | 4 +-
.../response/ODataPropertyUpdateResponse.java | 4 +-
.../api/domain/ODataEntitySetIterator.java | 12 +-
.../olingo/client/api/op/CommonODataBinder.java | 33 +-
.../olingo/client/api/op/CommonODataReader.java | 12 +-
.../olingo/client/api/op/ODataWriter.java | 14 +-
.../olingo/client/api/op/v3/ODataBinder.java | 22 ++
.../olingo/client/api/op/v4/ODataBinder.java | 21 ++
.../olingo/client/api/v3/ODataClient.java | 10 +-
.../olingo/client/api/v4/ODataClient.java | 10 +-
.../olingo/client/core/AbstractODataClient.java | 9 -
.../request/cud/AbstractCUDRequestFactory.java | 16 +-
.../cud/ODataEntityCreateRequestImpl.java | 16 +-
.../cud/ODataEntityUpdateRequestImpl.java | 10 +-
.../cud/ODataPropertyUpdateRequestImpl.java | 10 +-
.../request/invoke/ODataInvokeRequestImpl.java | 24 +-
.../invoke/v3/InvokeRequestFactoryImpl.java | 18 +-
.../AbstractRetrieveRequestFactory.java | 18 -
.../retrieve/ODataEntityRequestImpl.java | 17 +-
.../retrieve/ODataEntitySetRequestImpl.java | 16 +-
.../retrieve/ODataPropertyRequestImpl.java | 19 +-
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 27 ++
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 30 +-
.../ODataMediaEntityCreateRequestImpl.java | 6 +-
.../ODataMediaEntityUpdateRequestImpl.java | 6 +-
.../client/core/op/AbstractODataBinder.java | 53 ++-
.../client/core/op/AbstractODataReader.java | 18 +-
.../olingo/client/core/op/ODataWriterImpl.java | 20 +-
.../client/core/op/impl/v3/ODataBinderImpl.java | 46 +++
.../client/core/op/impl/v4/ODataBinderImpl.java | 56 +++
.../olingo/client/core/v3/ODataClientImpl.java | 9 +
.../olingo/client/core/v4/ODataClientImpl.java | 9 +
.../client/core/it/AbstractTestITCase.java | 125 ++++---
.../client/core/it/v3/AsyncTestITCase.java | 18 +-
.../core/it/v3/EntityCreateTestITCase.java | 181 ++++-----
.../core/it/v3/EntityRetrieveTestITCase.java | 43 +--
.../client/core/it/v3/EntitySetTestITCase.java | 15 +-
.../core/it/v3/EntityUpdateTestITCase.java | 44 +--
.../client/core/it/v3/ErrorTestITCase.java | 13 +-
.../core/it/v3/FilterFactoryTestITCase.java | 4 +-
.../client/core/it/v3/FilterTestITCase.java | 4 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 21 +-
.../core/it/v3/MediaEntityTestITCase.java | 8 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 159 ++++----
.../client/core/it/v3/OpenTypeTestITCase.java | 129 ++++---
.../core/it/v3/PrimitiveKeysTestITCase.java | 8 +-
.../core/it/v3/PropertyRetrieveTestITCase.java | 41 +-
.../client/core/it/v3/PropertyTestITCase.java | 29 +-
.../core/it/v3/PropertyValueTestITCase.java | 18 +-
.../core/it/v3/QueryOptionsTestITCase.java | 38 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 52 +--
.../client/core/it/v4/EntitySetTestITCase.java | 18 +-
.../core/it/v4/PropertyValueTestITCase.java | 9 +-
.../olingo/client/core/v3/EntitySetTest.java | 6 +-
.../olingo/client/core/v3/EntityTest.java | 26 +-
.../olingo/client/core/v3/PropertyTest.java | 30 +-
.../commons/api/domain/CommonODataEntity.java | 177 +++++++++
.../api/domain/CommonODataEntitySet.java | 57 +++
.../api/domain/CommonODataObjectFactory.java | 210 +++++++++++
.../commons/api/domain/CommonODataProperty.java | 91 +++++
.../commons/api/domain/ODataComplexValue.java | 6 +-
.../olingo/commons/api/domain/ODataEntity.java | 197 ----------
.../commons/api/domain/ODataEntitySet.java | 57 ---
.../commons/api/domain/ODataInlineEntity.java | 8 +-
.../api/domain/ODataInlineEntitySet.java | 8 +-
.../commons/api/domain/ODataObjectFactory.java | 210 -----------
.../commons/api/domain/ODataProperty.java | 91 -----
.../commons/api/domain/v3/ODataEntity.java | 32 ++
.../commons/api/domain/v3/ODataEntitySet.java | 29 ++
.../api/domain/v3/ODataObjectFactory.java | 50 +++
.../commons/api/domain/v3/ODataProperty.java | 25 ++
.../commons/api/domain/v4/ODataEntity.java | 52 +++
.../commons/api/domain/v4/ODataEntitySet.java | 29 ++
.../commons/api/domain/v4/ODataEnumValue.java | 24 ++
.../api/domain/v4/ODataObjectFactory.java | 52 +++
.../commons/api/domain/v4/ODataProperty.java | 38 ++
.../commons/api/domain/v4/ODataValue.java | 36 ++
.../core/domain/AbstractODataEntity.java | 326 ++++++++++++++++
.../core/domain/AbstractODataEntitySet.java | 73 ++++
.../core/domain/AbstractODataObjectFactory.java | 133 +++++++
.../core/domain/AbstractODataProperty.java | 169 +++++++++
.../core/domain/ODataComplexValueImpl.java | 10 +-
.../commons/core/domain/ODataEntityImpl.java | 372 -------------------
.../commons/core/domain/ODataEntitySetImpl.java | 104 ------
.../core/domain/ODataObjectFactoryImpl.java | 171 ---------
.../commons/core/domain/ODataPropertyImpl.java | 172 ---------
.../commons/core/domain/v3/ODataEntityImpl.java | 46 +++
.../core/domain/v3/ODataEntitySetImpl.java | 51 +++
.../core/domain/v3/ODataObjectFactoryImpl.java | 75 ++++
.../core/domain/v3/ODataPropertyImpl.java | 33 ++
.../commons/core/domain/v4/ODataEntityImpl.java | 62 ++++
.../core/domain/v4/ODataEntitySetImpl.java | 51 +++
.../core/domain/v4/ODataObjectFactoryImpl.java | 81 ++++
.../core/domain/v4/ODataPropertyImpl.java | 44 +++
105 files changed, 3090 insertions(+), 2090 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index af904b3..ed0910a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeReq
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
import org.apache.olingo.client.api.op.ClientODataDeserializer;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.api.op.CommonODataReader;
import org.apache.olingo.commons.api.op.ODataSerializer;
@@ -56,7 +56,7 @@ public interface CommonODataClient {
CommonODataBinder getBinder();
- ODataObjectFactory getObjectFactory();
+ CommonODataObjectFactory getObjectFactory();
CommonRetrieveRequestFactory getRetrieveRequestFactory();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
index 48786be..f05eb1a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
@@ -20,10 +20,10 @@ package org.apache.olingo.client.api.communication.request.cud;
import java.io.Serializable;
import java.net.URI;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* OData request factory class.
@@ -39,17 +39,19 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param entity entity to be created.
* @return new ODataEntityCreateRequest instance.
*/
- ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, ODataEntity entity);
+ ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, CommonODataEntity entity);
/**
* Gets an update request object instance.
*
+ * @param <UT> concrete UpdateType.
* @param targetURI edit link of the object to be updated.
* @param type type of update to be performed.
* @param changes changes to be applied.
* @return new ODataEntityUpdateRequest instance.
*/
- <UT extends UpdateType> ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UT type, ODataEntity changes);
+ <UT extends UpdateType> ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UT type,
+ CommonODataEntity changes);
/**
* Gets an update request object instance; uses entity's edit link as endpoint.
@@ -58,7 +60,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param entity changes to be applied.
* @return new ODataEntityUpdateRequest instance.
*/
- ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, ODataEntity entity);
+ ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, CommonODataEntity entity);
/**
* Gets a create request object instance.
@@ -81,7 +83,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param property value to be update.
* @return new ODataPropertyUpdateRequest instance.
*/
- ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, ODataProperty property);
+ ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, CommonODataProperty property);
/**
* Gets an update request object instance.
@@ -94,7 +96,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @return new ODataPropertyUpdateRequest instance.
*/
ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest(
- URI targetURI, UpdateType type, ODataProperty property);
+ URI targetURI, UpdateType type, CommonODataProperty property);
/**
* Gets an update request object instance.
@@ -105,7 +107,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param property value to be update.
* @return new ODataPropertyUpdateRequest instance.
*/
- ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, ODataProperty property);
+ ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, CommonODataProperty property);
/**
* Gets an add link request object instance.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
index f613cbc..02ca4ee 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
@@ -20,6 +20,9 @@ package org.apache.olingo.client.api.communication.request.retrieve;
import java.io.Serializable;
import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* OData request factory class.
@@ -59,10 +62,11 @@ public interface CommonRetrieveRequestFactory extends Serializable {
/**
* Gets a query request returning a set of one or more OData entities.
*
+ * @param <T> concrete ODataEntitySet implementation.
* @param uri request URI.
* @return new {@link ODataEntitySetRequest} instance.
*/
- ODataEntitySetRequest getEntitySetRequest(URI uri);
+ <T extends CommonODataEntitySet> ODataEntitySetRequest<T> getEntitySetRequest(URI uri);
/**
* Gets a query request returning a set of one or more OData entities.
@@ -78,18 +82,20 @@ public interface CommonRetrieveRequestFactory extends Serializable {
/**
* Gets a query request returning a single OData entity.
*
+ * @param <T> concrete ODataEntity implementation.
* @param uri request URI.
* @return new {@link ODataEntityRequest} instance.
*/
- ODataEntityRequest getEntityRequest(URI uri);
+ <T extends CommonODataEntity> ODataEntityRequest<T> getEntityRequest(URI uri);
/**
* Gets a query request returning a single OData entity property.
*
+ * @param <T> concrete ODataProperty implementation.
* @param uri request URI.
* @return new {@link ODataPropertyRequest} instance.
*/
- ODataPropertyRequest getPropertyRequest(URI uri);
+ <T extends CommonODataProperty> ODataPropertyRequest<T> getPropertyRequest(URI uri);
/**
* Gets a query request returning a single OData entity property value.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
index a22f82c..aee9602 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
@@ -18,11 +18,11 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData retrieve query request returning a single entity.
*/
-public interface ODataEntityRequest extends ODataRetrieveRequest<ODataEntity, ODataPubFormat> {
+public interface ODataEntityRequest<T extends CommonODataEntity> extends ODataRetrieveRequest<T, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
index fbafafd..865596c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
*/
-public interface ODataEntitySetRequest extends ODataRetrieveRequest<ODataEntitySet, ODataPubFormat> {
+public interface ODataEntitySetRequest<T extends CommonODataEntitySet>
+ extends ODataRetrieveRequest<T, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
index 7492e11..f61783b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
@@ -18,11 +18,11 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an OData entity property query request.
*/
-public interface ODataPropertyRequest extends ODataRetrieveRequest<ODataProperty, ODataFormat> {
+public interface ODataPropertyRequest<T extends CommonODataProperty> extends ODataRetrieveRequest<T, ODataFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
index a0d667a..25276fe 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
@@ -20,9 +20,27 @@ package org.apache.olingo.client.api.communication.request.retrieve.v3;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
+ @SuppressWarnings("unchecked")
+ @Override
+ ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
+
+ @SuppressWarnings("unchecked")
+ @Override
+ ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
+
+ @SuppressWarnings("unchecked")
+ @Override
+ ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
+
/**
* Gets a query request returning a single OData link.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
index 55005cd..8d8184b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
@@ -18,7 +18,24 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve.v4;
+import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+@SuppressWarnings("unchecked")
public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
+
+ @Override
+ ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
+
+ @Override
+ ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
+
+ @Override
+ ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
index 5fd7fb8..0407422 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
* This class implements the response to an OData entity create request.
@@ -32,5 +32,5 @@ public interface ODataEntityCreateResponse extends ODataResponse {
*
* @return created object.
*/
- ODataEntity getBody();
+ CommonODataEntity getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
index 6b84630..59b0112 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
* This class implements the response to an OData update request.
@@ -32,5 +32,5 @@ public interface ODataEntityUpdateResponse extends ODataResponse {
*
* @return updated object.
*/
- ODataEntity getBody();
+ CommonODataEntity getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
index ea3b8b7..c29193b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
* This class implements the response to an Odata media entity create request.
@@ -32,5 +32,5 @@ public interface ODataMediaEntityCreateResponse extends ODataResponse {
*
* @return created object.
*/
- ODataEntity getBody();
+ CommonODataEntity getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
index f55dac8..97aab03 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
* This class implements the response to an Odata media entity update request.
@@ -32,5 +32,5 @@ public interface ODataMediaEntityUpdateResponse extends ODataResponse {
*
* @return updated object.
*/
- ODataEntity getBody();
+ CommonODataEntity getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
index 23bfc1e..61f5dbd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* This class implements the response to an OData update entity property request.
@@ -32,5 +32,5 @@ public interface ODataPropertyUpdateResponse extends ODataResponse {
*
* @return updated object.
*/
- ODataProperty getBody();
+ CommonODataProperty getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index e5eeeed..66e3476 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -32,8 +32,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
* <br/>
* <b>Please don't forget to call the <tt>close()>/<tt> method when not needed any more.</b>
*/
-public class ODataEntitySetIterator implements Iterator<ODataEntity> {
+public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
/**
* Logger.
@@ -59,7 +59,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
private Entry cached;
- private ODataEntitySet entitySet;
+ private CommonODataEntitySet entitySet;
private final ByteArrayOutputStream osFeed;
@@ -127,9 +127,9 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
* {@inheritDoc }
*/
@Override
- public ODataEntity next() {
+ public CommonODataEntity next() {
if (hasNext()) {
- final ODataEntity res = odataClient.getBinder().getODataEntity(cached);
+ final CommonODataEntity res = odataClient.getBinder().getODataEntity(cached);
cached = null;
return res;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
index 38fe16f..14fa946 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
@@ -25,10 +25,10 @@ import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
public interface CommonODataBinder extends Serializable {
@@ -40,7 +40,7 @@ public interface CommonODataBinder extends Serializable {
* @param reference reference class.
* @return <tt>Feed</tt> object.
*/
- Feed getFeed(ODataEntitySet feed, Class<? extends Feed> reference);
+ Feed getFeed(CommonODataEntitySet feed, Class<? extends Feed> reference);
/**
* Gets an <tt>Entry</tt> from the given OData entity.
@@ -49,7 +49,7 @@ public interface CommonODataBinder extends Serializable {
* @param reference reference class.
* @return <tt>Entry</tt> object.
*/
- Entry getEntry(ODataEntity entity, Class<? extends Entry> reference);
+ Entry getEntry(CommonODataEntity entity, Class<? extends Entry> reference);
/**
* Gets an <tt>Entry</tt> from the given OData entity.
@@ -59,7 +59,7 @@ public interface CommonODataBinder extends Serializable {
* @param setType whether to explicitly output type information.
* @return <tt>Entry</tt> object.
*/
- Entry getEntry(ODataEntity entity, Class<? extends Entry> reference, boolean setType);
+ Entry getEntry(CommonODataEntity entity, Class<? extends Entry> reference, boolean setType);
/**
* Gets a <tt>Link</tt> from the given OData link.
@@ -78,7 +78,16 @@ public interface CommonODataBinder extends Serializable {
* @param setType whether to explicitly output type information.
* @return <tt>Property</tt> object.
*/
- Property getProperty(ODataProperty property, Class<? extends Entry> reference, boolean setType);
+ Property getProperty(CommonODataProperty property, Class<? extends Entry> reference, boolean setType);
+
+ /**
+ * Adds the given property to the given entity.
+ *
+ * @param entity OData entity.
+ * @param property OData property.
+ * @return whether add was successful or not.
+ */
+ boolean add(CommonODataEntity entity, CommonODataProperty property);
/**
* Gets <tt>ODataServiceDocument</tt> from the given service document resource.
@@ -94,7 +103,7 @@ public interface CommonODataBinder extends Serializable {
* @param resource feed resource.
* @return <tt>ODataEntitySet</tt> object.
*/
- ODataEntitySet getODataEntitySet(Feed resource);
+ CommonODataEntitySet getODataEntitySet(Feed resource);
/**
* Gets <tt>ODataEntitySet</tt> from the given feed resource.
@@ -103,7 +112,7 @@ public interface CommonODataBinder extends Serializable {
* @param defaultBaseURI default base URI.
* @return <tt>ODataEntitySet</tt> object.
*/
- ODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
+ CommonODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
/**
* Gets <tt>ODataEntity</tt> from the given entry resource.
@@ -111,7 +120,7 @@ public interface CommonODataBinder extends Serializable {
* @param resource entry resource.
* @return <tt>ODataEntity</tt> object.
*/
- ODataEntity getODataEntity(Entry resource);
+ CommonODataEntity getODataEntity(Entry resource);
/**
* Gets <tt>ODataEntity</tt> from the given entry resource.
@@ -120,7 +129,7 @@ public interface CommonODataBinder extends Serializable {
* @param defaultBaseURI default base URI.
* @return <tt>ODataEntity</tt> object.
*/
- ODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
+ CommonODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
/**
* Gets an <tt>ODataProperty</tt> from the given property resource.
@@ -128,5 +137,5 @@ public interface CommonODataBinder extends Serializable {
* @param property property resource.
* @return <tt>ODataProperty</tt> object.
*/
- ODataProperty getODataProperty(Property property);
+ CommonODataProperty getODataProperty(Property property);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
index f13e0ac..923ac23 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
@@ -24,9 +24,9 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.Schema;
import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.format.ODataFormat;
@@ -74,7 +74,7 @@ public interface CommonODataReader extends Serializable {
* @param format de-serialize as AtomFeed or JSONFeed
* @return de-serialized entity set.
*/
- ODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
+ CommonODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
/**
* Parses a stream taking care to de-serializes the first OData entity found.
@@ -83,7 +83,7 @@ public interface CommonODataReader extends Serializable {
* @param format de-serialize as AtomEntry or JSONEntry
* @return entity de-serialized.
*/
- ODataEntity readEntity(InputStream input, ODataPubFormat format);
+ CommonODataEntity readEntity(InputStream input, ODataPubFormat format);
/**
* Parses a stream taking care to de-serialize the first OData entity property found.
@@ -92,7 +92,7 @@ public interface CommonODataReader extends Serializable {
* @param format de-serialize as XML or JSON
* @return OData entity property de-serialized.
*/
- ODataProperty readProperty(InputStream input, ODataFormat format);
+ CommonODataProperty readProperty(InputStream input, ODataFormat format);
/**
* Parses a stream into an OData error.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
index b83b2cd..a7ead37 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
@@ -21,9 +21,9 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Collection;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -43,7 +43,7 @@ public interface ODataWriter extends Serializable {
* @param format serialization format.
* @return stream of serialized objects.
*/
- InputStream writeEntities(Collection<ODataEntity> entities, ODataPubFormat format);
+ InputStream writeEntities(Collection<CommonODataEntity> entities, ODataPubFormat format);
/**
* Writes a collection of OData entities.
@@ -53,7 +53,7 @@ public interface ODataWriter extends Serializable {
* @param outputType whether to explicitly output type information.
* @return stream of serialized objects.
*/
- InputStream writeEntities(Collection<ODataEntity> entities, ODataPubFormat format, boolean outputType);
+ InputStream writeEntities(Collection<CommonODataEntity> entities, ODataPubFormat format, boolean outputType);
/**
* Serializes a single OData entity.
@@ -62,7 +62,7 @@ public interface ODataWriter extends Serializable {
* @param format serialization format.
* @return stream of serialized object.
*/
- InputStream writeEntity(ODataEntity entity, ODataPubFormat format);
+ InputStream writeEntity(CommonODataEntity entity, ODataPubFormat format);
/**
* Serializes a single OData entity.
@@ -72,7 +72,7 @@ public interface ODataWriter extends Serializable {
* @param outputType whether to explicitly output type information.
* @return stream of serialized object.
*/
- InputStream writeEntity(ODataEntity entity, ODataPubFormat format, boolean outputType);
+ InputStream writeEntity(CommonODataEntity entity, ODataPubFormat format, boolean outputType);
/**
* Writes a single OData entity property.
@@ -81,7 +81,7 @@ public interface ODataWriter extends Serializable {
* @param format serialization format.
* @return stream of serialized object.
*/
- InputStream writeProperty(ODataProperty property, ODataFormat format);
+ InputStream writeProperty(CommonODataProperty property, ODataFormat format);
/**
* Writes an OData link.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
index 6ea90ba..52cb625 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
@@ -18,12 +18,34 @@
*/
package org.apache.olingo.client.api.op.v3;
+import java.net.URI;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.op.CommonODataBinder;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
public interface ODataBinder extends CommonODataBinder {
+ @Override
+ ODataEntitySet getODataEntitySet(Feed resource);
+
+ @Override
+ ODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
+
+ @Override
+ ODataEntity getODataEntity(Entry resource);
+
+ @Override
+ ODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
+
+ @Override
+ ODataProperty getODataProperty(Property property);
+
/**
* Gets <tt>ODataLinkCollection</tt> from the given link collection resource.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
index 1397c47..f51c798 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
@@ -18,8 +18,29 @@
*/
package org.apache.olingo.client.api.op.v4;
+import java.net.URI;
import org.apache.olingo.client.api.op.CommonODataBinder;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
public interface ODataBinder extends CommonODataBinder {
+ @Override
+ ODataEntitySet getODataEntitySet(Feed resource);
+
+ @Override
+ ODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
+
+ @Override
+ ODataEntity getODataEntity(Entry resource);
+
+ @Override
+ ODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
+
+ @Override
+ ODataProperty getODataProperty(Property property);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
index 5959796..81bf6dc 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
@@ -29,10 +29,14 @@ import org.apache.olingo.client.api.op.v3.ODataDeserializer;
import org.apache.olingo.client.api.op.v3.ODataReader;
import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.apache.olingo.client.api.uri.v3.FilterFactory;
+import org.apache.olingo.commons.api.domain.v3.ODataObjectFactory;
public interface ODataClient extends CommonODataClient {
@Override
+ Configuration getConfiguration();
+
+ @Override
ODataDeserializer getDeserializer();
@Override
@@ -42,15 +46,15 @@ public interface ODataClient extends CommonODataClient {
ODataBinder getBinder();
@Override
- Configuration getConfiguration();
-
- @Override
URIBuilder getURIBuilder(String serviceRoot);
@Override
FilterFactory getFilterFactory();
@Override
+ ODataObjectFactory getObjectFactory();
+
+ @Override
RetrieveRequestFactory getRetrieveRequestFactory();
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
index afe3c70..51abf99 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
@@ -29,10 +29,14 @@ import org.apache.olingo.client.api.op.v4.ODataDeserializer;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.api.uri.v4.FilterFactory;
+import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
public interface ODataClient extends CommonODataClient {
@Override
+ Configuration getConfiguration();
+
+ @Override
ODataDeserializer getDeserializer();
@Override
@@ -42,15 +46,15 @@ public interface ODataClient extends CommonODataClient {
ODataBinder getBinder();
@Override
- Configuration getConfiguration();
-
- @Override
URIBuilder getURIBuilder(String serviceRoot);
@Override
FilterFactory getFilterFactory();
@Override
+ ODataObjectFactory getObjectFactory();
+
+ @Override
RetrieveRequestFactory getRetrieveRequestFactory();
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 405f95d..57b24df 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -19,9 +19,7 @@
package org.apache.olingo.client.core;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.op.ODataWriter;
-import org.apache.olingo.commons.core.domain.ODataObjectFactoryImpl;
import org.apache.olingo.client.core.op.ODataWriterImpl;
public abstract class AbstractODataClient implements CommonODataClient {
@@ -30,16 +28,9 @@ public abstract class AbstractODataClient implements CommonODataClient {
private final ODataWriter writer = new ODataWriterImpl(this);
- private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
-
@Override
public ODataWriter getWriter() {
return writer;
}
- @Override
- public ODataObjectFactory getObjectFactory() {
- return objectFactory;
- }
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
index e5bb42e..ae55269 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
@@ -29,10 +29,10 @@ import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateReq
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.UpdateType;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.client.api.http.HttpMethod;
public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFactory {
@@ -46,13 +46,13 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
}
@Override
- public ODataEntityCreateRequest getEntityCreateRequest(final URI targetURI, final ODataEntity entity) {
+ public ODataEntityCreateRequest getEntityCreateRequest(final URI targetURI, final CommonODataEntity entity) {
return new ODataEntityCreateRequestImpl(client, targetURI, entity);
}
@Override
public ODataEntityUpdateRequest getEntityUpdateRequest(
- final URI targetURI, final UpdateType type, final ODataEntity changes) {
+ final URI targetURI, final UpdateType type, final CommonODataEntity changes) {
final ODataEntityUpdateRequest req;
@@ -67,7 +67,7 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
}
@Override
- public ODataEntityUpdateRequest getEntityUpdateRequest(final UpdateType type, final ODataEntity entity) {
+ public ODataEntityUpdateRequest getEntityUpdateRequest(final UpdateType type, final CommonODataEntity entity) {
if (entity.getEditLink() == null) {
throw new IllegalArgumentException("No edit link found");
}
@@ -102,7 +102,7 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
@Override
public ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(
- final URI targetURI, final ODataProperty property) {
+ final URI targetURI, final CommonODataProperty property) {
if (!property.hasPrimitiveValue()) {
throw new IllegalArgumentException("A primitive value is required");
@@ -122,7 +122,7 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
@Override
public ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest(
- final URI targetURI, final UpdateType type, final ODataProperty property) {
+ final URI targetURI, final UpdateType type, final CommonODataProperty property) {
if (!property.hasComplexValue()) {
throw new IllegalArgumentException("A complex value is required");
@@ -142,7 +142,7 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
@Override
public ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(
- final URI targetURI, final ODataProperty property) {
+ final URI targetURI, final CommonODataProperty property) {
if (!property.hasCollectionValue()) {
throw new IllegalArgumentException("A collection value is required");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index 8b9965f..f8bff7e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
@@ -46,7 +46,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
/**
* Entity to be created.
*/
- private final ODataEntity entity;
+ private final CommonODataEntity entity;
/**
* Constructor.
@@ -55,7 +55,9 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* @param targetURI entity set URI.
* @param entity entity to be created.
*/
- ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final ODataEntity entity) {
+ ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI,
+ final CommonODataEntity entity) {
+
super(odataClient, ODataPubFormat.class, HttpMethod.POST, targetURI);
this.entity = entity;
}
@@ -88,7 +90,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
*/
private class ODataEntityCreateResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse {
- private ODataEntity entity = null;
+ private CommonODataEntity entity = null;
/**
* Constructor.
@@ -112,12 +114,12 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* {@inheritDoc }
*/
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
if (entity == null) {
try {
- final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
+ final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
ODataPubFormat.fromString(getAccept()));
-
+
entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
index 693582a..dde98a4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
@@ -46,7 +46,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
/**
* Changes to be applied.
*/
- private final ODataEntity changes;
+ private final CommonODataEntity changes;
/**
* Constructor.
@@ -57,7 +57,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
* @param changes changes to be applied.
*/
ODataEntityUpdateRequestImpl(final CommonODataClient odataClient,
- final HttpMethod method, final URI uri, final ODataEntity changes) {
+ final HttpMethod method, final URI uri, final CommonODataEntity changes) {
super(odataClient, ODataPubFormat.class, method, uri);
this.changes = changes;
@@ -94,7 +94,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
/**
* Changes.
*/
- private ODataEntity entity = null;
+ private CommonODataEntity entity = null;
/**
* Constructor.
@@ -118,7 +118,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
* {@inheritDoc ]
*/
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
if (entity == null) {
try {
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
index 5b0f9fb..7345d30 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
@@ -46,7 +46,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
/**
* Value to be created.
*/
- private final ODataProperty property;
+ private final CommonODataProperty property;
/**
* Constructor.
@@ -57,7 +57,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
* @param property value to be created.
*/
ODataPropertyUpdateRequestImpl(final CommonODataClient odataClient,
- final HttpMethod method, final URI targetURI, final ODataProperty property) {
+ final HttpMethod method, final URI targetURI, final CommonODataProperty property) {
super(odataClient, ODataFormat.class, method, targetURI);
// set request body
@@ -92,7 +92,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
*/
private class ODataPropertyUpdateResponseImpl extends AbstractODataResponse implements ODataPropertyUpdateResponse {
- private ODataProperty property = null;
+ private CommonODataProperty property = null;
/**
* Constructor.
@@ -116,7 +116,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
* {@inheritDoc }
*/
@Override
- public ODataProperty getBody() {
+ public CommonODataProperty getBody() {
if (property == null) {
try {
final Container<Property> container = odataClient.getDeserializer().toProperty(getRawResponse(),
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index 213a886..4e7be37 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -25,6 +25,7 @@ import java.net.URISyntaxException;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
@@ -35,10 +36,10 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -98,23 +99,20 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
*/
@Override
public void setFormat(final ODataPubFormat format) {
- final String _format = (reference.isAssignableFrom(ODataProperty.class) && format == ODataPubFormat.ATOM)
+ final String _format = (reference.isAssignableFrom(CommonODataProperty.class) && format == ODataPubFormat.ATOM)
? ODataFormat.XML.toString(odataClient.getServiceVersion())
: format.toString(odataClient.getServiceVersion());
setAccept(_format);
setContentType(_format);
}
- /**
- * {@inheritDoc }
- */
@Override
protected InputStream getPayload() {
if (!this.parameters.isEmpty() && this.method == HttpMethod.POST) {
// Additional, non-binding parameters MUST be sent as JSON
- final ODataEntity tmp = odataClient.getObjectFactory().newEntity("");
+ final CommonODataEntity tmp = odataClient.getObjectFactory().newEntity(StringUtils.EMPTY);
for (Map.Entry<String, ODataValue> param : parameters.entrySet()) {
- ODataProperty property = null;
+ CommonODataProperty property = null;
if (param.getValue().isPrimitive()) {
property = odataClient.getObjectFactory().
@@ -128,7 +126,7 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
}
if (property != null) {
- tmp.getProperties().add(property);
+ odataClient.getBinder().add(tmp, property);
}
}
@@ -211,15 +209,15 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
}
try {
- if (reference.isAssignableFrom(ODataEntitySet.class)) {
+ if (reference.isAssignableFrom(CommonODataEntitySet.class)) {
invokeResult = (T) odataClient.getReader().readEntitySet(res.getEntity().getContent(),
ODataPubFormat.fromString(getContentType()));
}
- if (reference.isAssignableFrom(ODataEntity.class)) {
+ if (reference.isAssignableFrom(CommonODataEntity.class)) {
invokeResult = (T) odataClient.getReader().readEntity(res.getEntity().getContent(),
ODataPubFormat.fromString(getContentType()));
}
- if (reference.isAssignableFrom(ODataProperty.class)) {
+ if (reference.isAssignableFrom(CommonODataProperty.class)) {
invokeResult = (T) odataClient.getReader().readProperty(res.getEntity().getContent(),
ODataFormat.fromString(getContentType()));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
index 2487dd9..87e8c76 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
@@ -25,10 +25,10 @@ import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
@@ -96,14 +96,14 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory imple
client, ODataNoContent.class, method, uri);
} else {
if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntitySet>(
- client, ODataEntitySet.class, method, uri);
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<CommonODataEntitySet>(
+ client, CommonODataEntitySet.class, method, uri);
} else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntity>(
- client, ODataEntity.class, method, uri);
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<CommonODataEntity>(
+ client, CommonODataEntity.class, method, uri);
} else {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataProperty>(
- client, ODataProperty.class, method, uri);
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<CommonODataProperty>(
+ client, CommonODataProperty.class, method, uri);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
index 3eeabed..d8ec0f2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
@@ -21,12 +21,9 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
@@ -43,26 +40,11 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe
}
@Override
- public ODataEntitySetRequest getEntitySetRequest(final URI query) {
- return new ODataEntitySetRequestImpl(client, query);
- }
-
- @Override
public ODataEntitySetIteratorRequest getEntitySetIteratorRequest(final URI query) {
return new ODataEntitySetIteratorRequestImpl(client, query);
}
@Override
- public ODataEntityRequest getEntityRequest(final URI query) {
- return new ODataEntityRequestImpl(client, query);
- }
-
- @Override
- public ODataPropertyRequest getPropertyRequest(final URI query) {
- return new ODataPropertyRequestImpl(client, query);
- }
-
- @Override
public ODataValueRequest getValueRequest(final URI query) {
return new ODataValueRequestImpl(client, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
index 2c8955e..141b82e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
@@ -26,14 +26,14 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData retrieve query request returning a single entity.
*/
-public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEntity, ODataPubFormat>
- implements ODataEntityRequest {
+public class ODataEntityRequestImpl<T extends CommonODataEntity>
+ extends AbstractODataRetrieveRequest<T, ODataPubFormat> implements ODataEntityRequest<T> {
/**
* Private constructor.
@@ -41,7 +41,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntityRequestImpl(final CommonODataClient odataClient, final URI query) {
+ public ODataEntityRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
@@ -49,7 +49,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataEntity> execute() {
+ public ODataRetrieveResponse<T> execute() {
return new ODataEntityResponseImpl(httpClient, doExecute());
}
@@ -58,7 +58,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
*/
public class ODataEntityResponseImpl extends ODataRetrieveResponseImpl {
- private ODataEntity entity = null;
+ private T entity = null;
/**
* Constructor.
@@ -82,13 +82,14 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
* {@inheritDoc }
*/
@Override
- public ODataEntity getBody() {
+ @SuppressWarnings("unchecked")
+ public T getBody() {
if (entity == null) {
try {
final Container<Entry> container =
odataClient.getDeserializer().toEntry(getRawResponse(), ODataPubFormat.fromString(getContentType()));
- entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
+ entity = (T) odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index e6d5783..86fa45c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -26,16 +26,16 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
*/
-public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODataEntitySet, ODataPubFormat>
- implements ODataEntitySetRequest {
+public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
+ extends AbstractODataRetrieveRequest<T, ODataPubFormat> implements ODataEntitySetRequest<T> {
- private ODataEntitySet entitySet = null;
+ private T entitySet = null;
/**
* Private constructor.
@@ -43,7 +43,7 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntitySetRequestImpl(final CommonODataClient odataClient, final URI query) {
+ public ODataEntitySetRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
@@ -51,7 +51,7 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataEntitySet> execute() {
+ public ODataRetrieveResponse<T> execute() {
final HttpResponse res = doExecute();
return new ODataEntitySetResponseImpl(httpClient, res);
}
@@ -84,13 +84,13 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
*/
@Override
@SuppressWarnings("unchecked")
- public ODataEntitySet getBody() {
+ public T getBody() {
if (entitySet == null) {
try {
final Container<Feed> container =
odataClient.getDeserializer().toFeed(getRawResponse(), ODataPubFormat.fromString(getContentType()));
- entitySet = odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
+ entitySet = (T) odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
index 4b9aa2b..7878805 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -25,7 +25,7 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.commons.api.data.Container;
@@ -34,8 +34,8 @@ import org.apache.olingo.commons.api.data.Property;
/**
* This class implements an OData entity property query request.
*/
-public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<ODataProperty, ODataFormat>
- implements ODataPropertyRequest {
+public class ODataPropertyRequestImpl<T extends CommonODataProperty>
+ extends AbstractODataRetrieveRequest<T, ODataFormat> implements ODataPropertyRequest<T> {
/**
* Private constructor.
@@ -43,7 +43,7 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataPropertyRequestImpl(final CommonODataClient odataClient, final URI query) {
+ public ODataPropertyRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataFormat.class, query);
}
@@ -51,14 +51,14 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataProperty> execute() {
+ public ODataRetrieveResponse<T> execute() {
final HttpResponse res = doExecute();
return new ODataPropertyResponseImpl(httpClient, res);
}
protected class ODataPropertyResponseImpl extends ODataRetrieveResponseImpl {
- private ODataProperty property = null;
+ private T property = null;
/**
* Constructor.
@@ -82,14 +82,15 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
* {@inheritDoc }
*/
@Override
- public ODataProperty getBody() {
+ @SuppressWarnings("unchecked")
+ public T getBody() {
if (property == null) {
try {
final Container<Property> container =
odataClient.getDeserializer().toProperty(
- res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
+ res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
- property = odataClient.getBinder().getODataProperty(extractFromContainer(container));
+ property = (T) odataClient.getBinder().getODataProperty(extractFromContainer(container));
} catch (IOException e) {
throw new HttpClientException(e);
} finally {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
index f6ba5c1..b32dd30 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
@@ -19,11 +19,20 @@
package org.apache.olingo.client.core.communication.request.retrieve.v3;
import java.net.URI;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
implements RetrieveRequestFactory {
@@ -44,4 +53,22 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
public ODataLinkCollectionRequest getLinkCollectionRequest(final URI targetURI, final String linkName) {
return new ODataLinkCollectionRequestImpl((ODataClient) client, targetURI, linkName);
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI query) {
+ return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
+ return new ODataEntityRequestImpl<ODataEntity>(client, query);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI query) {
+ return new ODataPropertyRequestImpl<ODataProperty>(client, query);
+ }
}
[16/51] [abbrv] [OLINGO-200] V4 (de)serialization tests for EntitySet
and Property
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index 96d9937..5442d1d 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -52,6 +52,8 @@ public enum ODataServiceVersion {
public static final String JSON_ID = "jsonId";
+ public static final String JSON_ETAG = "jsonETag";
+
public static final String JSON_READ_LINK = "jsonReadLink";
public static final String JSON_EDIT_LINK = "jsonEditLink";
@@ -60,6 +62,10 @@ public enum ODataServiceVersion {
public static final String JSON_MEDIAEDIT_LINK = "jsonMediaEditLink";
+ public static final String JSON_MEDIA_CONTENT_TYPE = "jsonMediaContentType";
+
+ public static final String JSON_MEDIA_ETAG = "jsonMediaETag";
+
public static final String JSON_ASSOCIATION_LINK = "jsonAssociationLink";
public static final String JSON_NAVIGATION_LINK = "jsonNavigationLink";
@@ -85,10 +91,13 @@ public enum ODataServiceVersion {
{
put(JSON_TYPE, "odata.type");
put(JSON_ID, "odata.id");
+ put(JSON_ETAG, "odata.etag");
put(JSON_READ_LINK, "odata.readLink");
put(JSON_EDIT_LINK, "odata.editLink");
put(JSON_MEDIAREAD_LINK, "odata.mediaReadLink");
put(JSON_MEDIAEDIT_LINK, "odata.mediaEditLink");
+ put(JSON_MEDIA_CONTENT_TYPE, "odata.mediaContentType");
+ put(JSON_MEDIA_ETAG, "odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLinkUrl");
put(JSON_NAVIGATION_LINK, "@odata.navigationLinkUrl");
}
@@ -115,10 +124,13 @@ public enum ODataServiceVersion {
{
put(JSON_TYPE, "@odata.type");
put(JSON_ID, "@odata.id");
+ put(JSON_ETAG, "@odata.etag");
put(JSON_READ_LINK, "@odata.readLink");
put(JSON_EDIT_LINK, "@odata.editLink");
put(JSON_MEDIAREAD_LINK, "@odata.mediaReadLink");
put(JSON_MEDIAEDIT_LINK, "@odata.mediaEditLink");
+ put(JSON_MEDIA_CONTENT_TYPE, "@odata.mediaContentType");
+ put(JSON_MEDIA_ETAG, "@odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLink");
put(JSON_NAVIGATION_LINK, "@odata.navigationLink");
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
index 85d6775..4c0f346 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
@@ -55,6 +55,8 @@ public abstract class AbstractEntry extends AbstractODataObject implements Entry
private String mediaContentType;
+ private String mediaETag;
+
@Override
public String getETag() {
return eTag;
@@ -153,6 +155,16 @@ public abstract class AbstractEntry extends AbstractODataObject implements Entry
}
@Override
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+ @Override
+ public void setMediaETag(final String eTag) {
+ this.mediaETag = eTag;
+ }
+
+ @Override
public boolean isMediaEntry() {
return StringUtils.isNotBlank(this.mediaContentSource);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index a16d4ed..c2ffd8e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -232,6 +232,11 @@ public class AtomDeserializer extends AbstractAtomDealer {
entry.setSelfLink(link);
} else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
entry.setEditLink(link);
+ } else if (Constants.EDITMEDIA_LINK_REL.equals(link.getRel())) {
+ final Attribute mediaETag = event.asStartElement().getAttributeByName(etagQName);
+ if (mediaETag != null) {
+ entry.setMediaETag(mediaETag.getValue());
+ }
} else if (link.getRel().startsWith(
version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) {
entry.getNavigationLinks().add(link);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
index 97da12d..d9106a7 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
@@ -66,8 +66,8 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
foundEndProperty = true;
}
}
-
- return value == null? new PrimitiveValueImpl(StringUtils.EMPTY): value;
+
+ return value == null ? new PrimitiveValueImpl(StringUtils.EMPTY) : value;
}
private Value fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
index eaaa653..ef3eaf1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -100,14 +100,9 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
entry.setBaseURI(contextURL.substring(0, contextURL.indexOf(Constants.METADATA)));
}
- if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) {
- entry.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue());
- tree.remove(Constants.JSON_MEDIA_ETAG);
- }
-
- if (tree.hasNonNull(Constants.JSON_ETAG)) {
- entry.setETag(tree.get(Constants.JSON_ETAG).textValue());
- tree.remove(Constants.JSON_ETAG);
+ if (tree.hasNonNull(jsonETag)) {
+ entry.setETag(tree.get(jsonETag).textValue());
+ tree.remove(jsonETag);
}
if (tree.hasNonNull(jsonType)) {
@@ -143,11 +138,16 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
tree.remove(jsonMediaReadLink);
}
if (tree.hasNonNull(jsonMediaEditLink)) {
+ entry.setMediaContentSource(tree.get(jsonMediaEditLink).textValue());
tree.remove(jsonMediaEditLink);
}
- if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- entry.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue());
- tree.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ if (tree.hasNonNull(jsonMediaContentType)) {
+ entry.setMediaContentType(tree.get(jsonMediaContentType).textValue());
+ tree.remove(jsonMediaContentType);
+ }
+ if (tree.hasNonNull(jsonMediaETag)) {
+ entry.setMediaETag(tree.get(jsonMediaETag).textValue());
+ tree.remove(jsonMediaETag);
}
final Set<String> toRemove = new HashSet<String>();
@@ -190,14 +190,14 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
link.setType(ODataLinkType.MEDIA_EDIT.toString());
entry.getMediaEditLinks().add(link);
- if (tree.has(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX)) {
- link.setMediaETag(tree.get(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX).asText());
- toRemove.add(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX);
+ if (tree.has(link.getTitle() + getJSONAnnotation(jsonMediaETag))) {
+ link.setMediaETag(tree.get(link.getTitle() + getJSONAnnotation(jsonMediaETag)).asText());
+ toRemove.add(link.getTitle() + getJSONAnnotation(jsonMediaETag));
}
toRemove.add(field.getKey());
toRemove.add(setInline(field.getKey(), getJSONAnnotation(jsonMediaEditLink), tree, parser.getCodec(), link));
- } else if (field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)) {
+ } else if (field.getKey().endsWith(getJSONAnnotation(jsonMediaContentType))) {
final String linkTitle = getTitle(field);
for (Link link : entry.getMediaEditLinks()) {
if (linkTitle.equals(link.getTitle())) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
index a83332a..edf4366 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
@@ -30,25 +30,4 @@ public class JSONEntryImpl extends AbstractEntry {
private static final long serialVersionUID = -5275365545400797758L;
- private String mediaETag;
-
- /**
- * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
- * media entity or named stream property.
- *
- * @return odata.mediaEtag annotation value.
- */
- public String getMediaETag() {
- return mediaETag;
- }
-
- /**
- * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
- * media entity or named stream property.
- *
- * @param eTag odata.mediaEtag annotation value.
- */
- public void setMediaETag(final String eTag) {
- this.mediaETag = eTag;
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 1215c5d..737ed53 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
+import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
/**
@@ -40,20 +41,17 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPrope
final JSONPropertyImpl property = new JSONPropertyImpl();
- String contextURL = null;
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
+ final String contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
+ property.setName(StringUtils.substringAfterLast(contextURL, "/"));
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- contextURL = tree.get(Constants.JSON_METADATA).textValue();
- tree.remove(Constants.JSON_METADATA);
- }
-
- if (contextURL != null) {
- final int dashIdx = contextURL.lastIndexOf('#');
+ final String metadata = tree.get(Constants.JSON_METADATA).textValue();
+ final int dashIdx = metadata.lastIndexOf('#');
if (dashIdx != -1) {
- property.setType(contextURL.substring(dashIdx + 1));
+ property.setType(metadata.substring(dashIdx + 1));
}
+ tree.remove(Constants.JSON_METADATA);
}
if (tree.has(jsonType) && property.getType() == null) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
index baf418d..fa6e38f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
@@ -34,6 +34,8 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
protected String jsonId;
+ protected String jsonETag;
+
protected String jsonReadLink;
protected String jsonEditLink;
@@ -42,6 +44,10 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
protected String jsonMediaReadLink;
+ protected String jsonMediaContentType;
+
+ protected String jsonMediaETag;
+
protected String jsonAssociationLink;
protected String jsonNavigationLink;
@@ -61,10 +67,13 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
jsonType = version.getJSONMap().get(ODataServiceVersion.JSON_TYPE);
jsonId = version.getJSONMap().get(ODataServiceVersion.JSON_ID);
+ jsonETag = version.getJSONMap().get(ODataServiceVersion.JSON_ETAG);
jsonReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_READ_LINK);
jsonEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK);
jsonMediaReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK);
jsonMediaEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK);
+ jsonMediaContentType = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE);
+ jsonMediaETag = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG);
jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK);
jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
index fe2fd52..181f2da 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
@@ -56,9 +56,7 @@ public abstract class AbstractODataCollectionValue<OV extends ODataValue>
*/
@Override
public void add(final OV value) {
- if (value.isPrimitive() || value.isComplex()) {
- values.add(value);
- }
+ values.add(value);
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
index a1b729f..06b525c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
@@ -56,6 +56,11 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
private String mediaContentSource;
/**
+ * Media ETag.
+ */
+ private String mediaETag;
+
+ /**
* Edit link.
*/
private URI editLink;
@@ -80,41 +85,20 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
*/
private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
- /**
- * Constructor.
- *
- * @param name OData entity name.
- */
public AbstractODataEntity(final String name) {
super(name);
}
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
@Override
public String getETag() {
return eTag;
}
- /**
- * Sets ETag.
- *
- * @param eTag ETag.
- */
@Override
public void setETag(final String eTag) {
this.eTag = eTag;
}
- /**
- * Searches for operation with given title.
- *
- * @param title operation to look for
- * @return operation if found with given title, <tt>null</tt> otherwise
- */
@Override
public ODataOperation getOperation(final String title) {
ODataOperation result = null;
@@ -137,12 +121,6 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
return this.operations;
}
- /**
- * Searches for property with given name.
- *
- * @param name property to look for
- * @return property if found with given name, <tt>null</tt> otherwise
- */
@Override
public CommonODataProperty getProperty(final String name) {
CommonODataProperty result = null;
@@ -158,12 +136,6 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
return result;
}
- /**
- * Puts the given link into one of available lists, based on its type.
- *
- * @param link to be added
- * @return <tt>true</tt> if the given link was added in one of available lists
- */
@Override
public boolean addLink(final ODataLink link) {
boolean result = false;
@@ -188,62 +160,57 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
return result;
}
- /**
- * Removes the given link from any list (association, navigation, edit-media).
- *
- * @param link to be removed
- * @return <tt>true</tt> if the given link was contained in one of available lists
- */
@Override
public boolean removeLink(final ODataLink link) {
return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
}
- /**
- * Returns all entity navigation links (including inline entities / feeds).
- *
- * @return OData entity links.
- */
+ private ODataLink getLink(final List<ODataLink> links, final String name) {
+ ODataLink result = null;
+ for (ODataLink link : links) {
+ if (name.equals(link.getName())) {
+ result = link;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public ODataLink getNavigationLink(final String name) {
+ return getLink(navigationLinks, name);
+ }
+
@Override
public List<ODataLink> getNavigationLinks() {
return navigationLinks;
}
- /**
- * Returns all entity association links.
- *
- * @return OData entity links.
- */
+ @Override
+ public ODataLink getAssociationLink(final String name) {
+ return getLink(associationLinks, name);
+ }
+
@Override
public List<ODataLink> getAssociationLinks() {
return associationLinks;
}
- /**
- * Returns all entity media edit links.
- *
- * @return OData entity links.
- */
+ @Override
+ public ODataLink getEditMediaLink(final String name) {
+ return getLink(editMediaLinks, name);
+ }
+
@Override
public List<ODataLink> getEditMediaLinks() {
return editMediaLinks;
}
- /**
- * Returns OData entity edit link.
- *
- * @return entity edit link.
- */
@Override
public URI getEditLink() {
return editLink;
}
- /**
- * Sets OData entity edit link.
- *
- * @param editLink edit link.
- */
@Override
public void setEditLink(final URI editLink) {
this.editLink = editLink;
@@ -254,73 +221,48 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
return super.getLink() == null ? getEditLink() : super.getLink();
}
- /**
- * TRUE if read-only entity.
- *
- * @return TRUE if read-only; FALSE otherwise.
- */
@Override
public boolean isReadOnly() {
return super.getLink() != null;
}
- /**
- * Checks if the current entity is a media entity.
- *
- * @return 'TRUE' if media entity; 'FALSE' otherwise.
- */
@Override
public boolean isMediaEntity() {
return mediaEntity;
}
- /**
- * Sets media entity flag.
- *
- * @param isMediaEntity media entity flag value.
- */
@Override
public void setMediaEntity(final boolean isMediaEntity) {
this.mediaEntity = isMediaEntity;
}
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
@Override
public String getMediaContentType() {
return mediaContentType;
}
- /**
- * Sets media content type.
- *
- * @param mediaContentType media content type.
- */
@Override
public void setMediaContentType(final String mediaContentType) {
this.mediaContentType = mediaContentType;
}
- /**
- * Gets media content source.
- *
- * @return media content source.
- */
@Override
public String getMediaContentSource() {
return mediaContentSource;
}
- /**
- * Sets media content source.
- *
- * @param mediaContentSource media content source.
- */
@Override
public void setMediaContentSource(final String mediaContentSource) {
this.mediaContentSource = mediaContentSource;
}
+
+ @Override
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+ @Override
+ public void setMediaETag(final String eTag) {
+ this.mediaETag = eTag;
+ }
}
[22/51] [abbrv] git commit: [OLINGO-227] added some rat test and
gitignore excludes for generated files
Posted by sk...@apache.org.
[OLINGO-227] added some rat test and gitignore excludes for generated files
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/27060ffd
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/27060ffd
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/27060ffd
Branch: refs/heads/olingo-206-validator
Commit: 27060ffd0fedbeb1644b08567c122d658de009d1
Parents: b250803
Author: Stephan Klevenz <st...@sap.com>
Authored: Tue Apr 1 13:54:06 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Tue Apr 1 13:54:06 2014 +0200
----------------------------------------------------------------------
.gitignore | 2 ++
pom.xml | 2 ++
2 files changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/27060ffd/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 2095344..947434b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,5 @@ classes
.DS_Store
*.local
nb-configuration.xml
+.externalToolBuilders
+maven-eclipse.xml
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/27060ffd/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6b0668b..b0c4839 100644
--- a/pom.xml
+++ b/pom.xml
@@ -401,6 +401,8 @@
<exclude>**/NOTICE</exclude>
<exclude>**/DEPENDENCIES</exclude>
<exclude>**/nb-configuration.xml</exclude>
+ <exclude>**/.externalToolBuilders/**</exclude>
+ <exclude>**/maven-eclipse.xml</exclude>
</excludes>
</configuration>
</execution>
[13/51] [abbrv] [OLINGO-200] V4 ODataValue full reachable via API
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
index cddd66d..18613cf 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
@@ -23,7 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -38,7 +38,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveIntPropertyValueTest() throws EdmPrimitiveTypeException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PersonID").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -48,7 +48,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveBooleanPropertyValueTest() throws EdmPrimitiveTypeException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("IsRegistered").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -58,7 +58,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveStringPropertyValueTest() throws EdmPrimitiveTypeException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("FirstName").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -68,7 +68,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveDatePropertyValueTest() {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Orders").appendKeySegment(8).appendPropertySegment("OrderDate").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -79,7 +79,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveDecimalPropertyValueTest() throws EdmPrimitiveTypeException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Height").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -90,7 +90,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveBinaryPropertyValueTest() throws IOException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -102,7 +102,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test(expected = ODataClientErrorException.class)
public void retrieveBinaryPropertyValueTestWithAtom() throws IOException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -112,7 +112,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test(expected = ODataClientErrorException.class)
public void retrieveBinaryPropertyValueTestWithXML() throws IOException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -122,7 +122,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveCollectionPropertyValueTest() {
- CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers");
final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
getPropertyRequest(uriBuilder.build());
@@ -134,7 +134,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveNullPropertyValueTest() {
- CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("MiddleName").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 4b3167e..8676d6f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -31,11 +31,12 @@ import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataFormat;
+
import org.junit.Test;
public class PropertyTest extends AbstractTest {
@@ -57,15 +58,15 @@ public class PropertyTest extends AbstractTest {
assertEquals("-10", value.toString());
}
- private CommonODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
+ private ODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId." + getSuffix(format));
- final CommonODataProperty property = getClient().getReader().readProperty(input, format);
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasPrimitiveValue());
assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class));
- CommonODataProperty comparable;
- final CommonODataProperty written = getClient().getReader().readProperty(
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
@@ -93,24 +94,24 @@ public class PropertyTest extends AbstractTest {
primitive(ODataFormat.JSON);
}
- private CommonODataProperty complex(final ODataFormat format) throws IOException {
+ private ODataProperty complex(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_PrimaryContactInfo." + getSuffix(format));
- final CommonODataProperty property = getClient().getReader().readProperty(input, format);
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasComplexValue());
assertEquals(6, property.getComplexValue().size());
- CommonODataProperty comparable;
- final CommonODataProperty written = getClient().getReader().readProperty(
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataComplexValue typedValue = getClient().getObjectFactory().
+ final ODataComplexValue<ODataProperty> typedValue = getClient().getObjectFactory().
newComplexValue(property.getComplexValue().getTypeName());
- for (final Iterator<CommonODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
- final CommonODataProperty prop = itor.next();
+ for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+ final ODataProperty prop = itor.next();
typedValue.add(prop);
}
comparable = getClient().getObjectFactory().newComplexProperty(written.getName(), typedValue);
@@ -131,21 +132,21 @@ public class PropertyTest extends AbstractTest {
complex(ODataFormat.JSON);
}
- private CommonODataProperty collection(final ODataFormat format) throws IOException {
+ private ODataProperty collection(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_BackupContactInfo." + getSuffix(format));
- final CommonODataProperty property = getClient().getReader().readProperty(input, format);
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasCollectionValue());
assertEquals(9, property.getCollectionValue().size());
- CommonODataProperty comparable;
- final CommonODataProperty written = getClient().getReader().readProperty(
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataCollectionValue typedValue = getClient().getObjectFactory().
+ final ODataCollectionValue<ODataValue> typedValue = getClient().getObjectFactory().
newCollectionValue(property.getCollectionValue().getTypeName());
for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
final ODataValue value = itor.next();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index f9c57c2..97b6a44 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -28,9 +28,9 @@ import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
@@ -107,15 +107,15 @@ public class EntityTest extends AbstractTest {
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", skinColor.getEnumValue().getTypeName());
assertEquals("Red", skinColor.getEnumValue().getValue());
-// final ODataProperty coverColors = entity.getProperty("CoverColors");
-// assertTrue(coverColors.hasCollectionValue());
-// for (final Iterator<ODataValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
-// final ODataValue item = itor.next();
-// assertTrue(item.isEnum());
-// }
+ final ODataProperty coverColors = entity.getProperty("CoverColors");
+ assertTrue(coverColors.hasCollectionValue());
+ for (final Iterator<ODataValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
+ final ODataValue item = itor.next();
+ assertTrue(item.isEnum());
+ }
// operations won't get serialized
- entity.getOperations().clear();
+ entity.getOperations().clear();
final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
index 1dbfdf8..4fb9de9 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
@@ -35,7 +35,7 @@ public abstract class AbstractODataValue implements ODataValue {
*/
private final String typeName;
- public AbstractODataValue(String typeName) {
+ public AbstractODataValue(final String typeName) {
this.typeName = typeName;
}
@@ -79,9 +79,10 @@ public abstract class AbstractODataValue implements ODataValue {
*
* @return complex value.
*/
+// @SuppressWarnings("unchecked")
@Override
- public ODataComplexValue asComplex() {
- return isComplex() ? (ODataComplexValue) this : null;
+ public <OP extends CommonODataProperty> ODataComplexValue<OP> asComplex() {
+ return isComplex() ? (ODataComplexValue<OP>) this : null;
}
/**
@@ -99,9 +100,10 @@ public abstract class AbstractODataValue implements ODataValue {
*
* @return collection value.
*/
+// @SuppressWarnings("unchecked")
@Override
- public ODataCollectionValue asCollection() {
- return isCollection() ? (ODataCollectionValue) this : null;
+ public <OV extends ODataValue> ODataCollectionValue<OV> asCollection() {
+ return isCollection() ? (ODataCollectionValue<OV>) this : null;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
index 40ffda9..434906e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
@@ -177,9 +177,9 @@ public interface CommonODataObjectFactory {
ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
- ODataComplexValue newComplexValue(String typeName);
+ ODataComplexValue<? extends CommonODataProperty> newComplexValue(String typeName);
- ODataCollectionValue newCollectionValue(String typeName);
+ ODataCollectionValue<? extends ODataValue> newCollectionValue(String typeName);
/**
* Instantiates a new primitive property.
@@ -197,7 +197,7 @@ public interface CommonODataObjectFactory {
* @param value value.
* @return complex property.
*/
- CommonODataProperty newComplexProperty(String name, ODataComplexValue value);
+ CommonODataProperty newComplexProperty(String name, ODataComplexValue<? extends CommonODataProperty> value);
/**
* Instantiates a new collection property.
@@ -206,5 +206,5 @@ public interface CommonODataObjectFactory {
* @param value value.
* @return collection property.
*/
- CommonODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+ CommonODataProperty newCollectionProperty(String name, ODataCollectionValue<? extends ODataValue> value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
index 99a5131..8eae93e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
@@ -68,24 +68,10 @@ public interface CommonODataProperty extends ODataInvokeResult, Serializable {
boolean hasCollectionValue();
/**
- * Gets collection value.
- *
- * @return collection value if exists; null otherwise.
- */
- ODataCollectionValue getCollectionValue();
-
- /**
* Checks if has complex value.
*
* @return 'TRUE' if has complex value; 'FALSE' otherwise.
*/
boolean hasComplexValue();
- /**
- * Gets complex value.
- *
- * @return complex value if exists; null otherwise.
- */
- ODataComplexValue getComplexValue();
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
index d0daf59..29eedab 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
@@ -20,15 +20,17 @@ package org.apache.olingo.commons.api.domain;
/**
* OData collection property value.
+ *
+ * @param <OV> The actual ODataValue interface.
*/
-public interface ODataCollectionValue extends ODataValue, Iterable<ODataValue> {
+public interface ODataCollectionValue<OV extends ODataValue> extends ODataValue, Iterable<OV> {
/**
* Adds a value to the collection.
*
* @param value value to be added.
*/
- void add(ODataValue value);
+ void add(OV value);
/**
* Checks if collection is empty.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
index b34006c..7eb02c0 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
@@ -20,15 +20,17 @@ package org.apache.olingo.commons.api.domain;
/**
* OData complex property value.
+ *
+ * @param <OP> The actual ODataProperty interface.
*/
-public interface ODataComplexValue extends ODataValue, Iterable<CommonODataProperty> {
+public interface ODataComplexValue<OP extends CommonODataProperty> extends ODataValue, Iterable<OP> {
/**
* Adds field to the complex type.
*
* @param field field to be added.
*/
- void add(CommonODataProperty field);
+ void add(OP field);
/**
* Gets field.
@@ -36,7 +38,7 @@ public interface ODataComplexValue extends ODataValue, Iterable<CommonODataPrope
* @param name name of the field to be retrieved.
* @return requested field.
*/
- CommonODataProperty get(String name);
+ OP get(String name);
/**
* Gets number of fields.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
index 6db4b2b..0727976 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
@@ -56,9 +56,10 @@ public interface ODataValue extends Serializable {
/**
* Casts to collection value.
*
+ * @param <OV> The actual ODataValue interface.
* @return collection value.
*/
- ODataCollectionValue asCollection();
+ <OV extends ODataValue> ODataCollectionValue<OV> asCollection();
/**
* Check is is a complex value.
@@ -70,8 +71,9 @@ public interface ODataValue extends Serializable {
/**
* Casts to complex value.
*
+ * @param <OP> The actual ODataProperty interface.
* @return complex value.
*/
- ODataComplexValue asComplex();
+ <OP extends CommonODataProperty> ODataComplexValue<OP> asComplex();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
index 363f1de..31f5ba1 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
@@ -20,9 +20,11 @@ package org.apache.olingo.commons.api.domain.v3;
import java.net.URI;
import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
public interface ODataObjectFactory extends CommonODataObjectFactory {
@@ -39,12 +41,18 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
ODataEntity newEntity(String name, URI link);
@Override
+ ODataComplexValue<ODataProperty> newComplexValue(String typeName);
+
+ @Override
+ ODataCollectionValue<ODataValue> newCollectionValue(String typeName);
+
+ @Override
ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
@Override
- ODataProperty newComplexProperty(String name, ODataComplexValue value);
+ ODataProperty newComplexProperty(String name, ODataComplexValue<? extends CommonODataProperty> value);
@Override
- ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+ ODataProperty newCollectionProperty(String name, ODataCollectionValue<? extends ODataValue> value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
index 266d53c..46f1c39 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
@@ -19,7 +19,23 @@
package org.apache.olingo.commons.api.domain.v3;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
public interface ODataProperty extends CommonODataProperty {
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ ODataCollectionValue<ODataValue> getCollectionValue();
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ ODataComplexValue<ODataProperty> getComplexValue();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
index d12f0dc..67adf57 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
@@ -20,6 +20,7 @@ package org.apache.olingo.commons.api.domain.v4;
import java.net.URI;
import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
@@ -41,14 +42,21 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
ODataEnumValue newEnumValue(String typeName, String value);
@Override
+ ODataComplexValue<ODataProperty> newComplexValue(String typeName);
+
+ @Override
+ ODataCollectionValue<ODataValue> newCollectionValue(String typeName);
+
+ @Override
ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
ODataProperty newEnumProperty(String name, ODataEnumValue value);
@Override
- ODataProperty newComplexProperty(String name, ODataComplexValue value);
+ ODataProperty newComplexProperty(String name, ODataComplexValue<? extends CommonODataProperty> value);
@Override
- ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+ ODataProperty newCollectionProperty(String name,
+ ODataCollectionValue<? extends org.apache.olingo.commons.api.domain.ODataValue> value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
index 61a8193..4666e6e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
@@ -19,10 +19,26 @@
package org.apache.olingo.commons.api.domain.v4;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
public interface ODataProperty extends CommonODataProperty {
/**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ ODataCollectionValue<ODataValue> getCollectionValue();
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ ODataComplexValue<ODataProperty> getComplexValue();
+
+ /**
* Checks if has enum value.
*
* @return 'TRUE' if has enum value; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
new file mode 100644
index 0000000..fe2fd52
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
@@ -0,0 +1,93 @@
+/*
+ * 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.commons.core.domain;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
+
+/**
+ * OData collection property value.
+ *
+ * @param <OV> The actual ODataValue interface.
+ */
+public abstract class AbstractODataCollectionValue<OV extends ODataValue>
+ extends AbstractODataValue implements ODataCollectionValue<OV> {
+
+ private static final long serialVersionUID = -3665659846001987187L;
+
+ /**
+ * Values.
+ */
+ private final List<OV> values = new ArrayList<OV>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public AbstractODataCollectionValue(final String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * Adds a value to the collection.
+ *
+ * @param value value to be added.
+ */
+ @Override
+ public void add(final OV value) {
+ if (value.isPrimitive() || value.isComplex()) {
+ values.add(value);
+ }
+ }
+
+ /**
+ * Value iterator.
+ *
+ * @return value iterator.
+ */
+ @Override
+ public Iterator<OV> iterator() {
+ return values.iterator();
+ }
+
+ /**
+ * Gets collection size.
+ *
+ * @return collection size.
+ */
+ @Override
+ public int size() {
+ return values.size();
+ }
+
+ /**
+ * Checks if collection is empty.
+ *
+ * @return 'TRUE' if empty; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isEmpty() {
+ return values.isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataComplexValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataComplexValue.java
new file mode 100644
index 0000000..6a09664
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataComplexValue.java
@@ -0,0 +1,93 @@
+/*
+ * 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.commons.core.domain;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+
+/**
+ * OData complex property value.
+ *
+ * @param <OP> The actual ODataProperty interface.
+ */
+public abstract class AbstractODataComplexValue<OP extends CommonODataProperty>
+ extends AbstractODataValue implements ODataComplexValue<OP> {
+
+ private static final long serialVersionUID = -1878555027714020431L;
+
+ /**
+ * Complex type fields.
+ */
+ private final Map<String, OP> fields = new LinkedHashMap<String, OP>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public AbstractODataComplexValue(final String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * Adds field to the complex type.
+ *
+ * @param field field to be added.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public void add(final CommonODataProperty field) {
+ fields.put(field.getName(), (OP) field);
+ }
+
+ /**
+ * Gets field.
+ *
+ * @param name name of the field to be retrieved.
+ * @return requested field.
+ */
+ @Override
+ public OP get(final String name) {
+ return fields.get(name);
+ }
+
+ /**
+ * Complex property fields iterator.
+ *
+ * @return fields iterator.
+ */
+ @Override
+ public Iterator<OP> iterator() {
+ return fields.values().iterator();
+ }
+
+ /**
+ * Gets number of fields.
+ *
+ * @return number of fields.
+ */
+ @Override
+ public int size() {
+ return fields.size();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
index a3133cd..43853fa 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
@@ -20,15 +20,12 @@ package org.apache.olingo.commons.core.domain;
import java.net.URI;
import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public abstract class AbstractODataObjectFactory implements CommonODataObjectFactory {
@@ -115,19 +112,4 @@ public abstract class AbstractODataObjectFactory implements CommonODataObjectFac
setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
}
- @Override
- public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
- return new ODataPrimitiveValueImpl.BuilderImpl(version);
- }
-
- @Override
- public ODataComplexValue newComplexValue(final String typeName) {
- return new ODataComplexValueImpl(typeName);
- }
-
- @Override
- public ODataCollectionValue newCollectionValue(final String typeName) {
- return new ODataCollectionValueImpl(typeName);
- }
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java
new file mode 100644
index 0000000..9d2d6ec
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java
@@ -0,0 +1,179 @@
+/*
+ * 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.commons.core.domain;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public abstract class AbstractODataPrimitiveValue extends AbstractODataValue implements ODataPrimitiveValue {
+
+ private static final long serialVersionUID = 8889282662298376036L;
+
+ public static abstract class AbstractBuilder implements Builder {
+
+ private final ODataServiceVersion version;
+
+ public AbstractBuilder(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ protected abstract AbstractODataPrimitiveValue getInstance();
+
+ @Override
+ public AbstractBuilder setType(final EdmPrimitiveTypeKind type) {
+ if (type != null && !type.getSupportedVersions().contains(version)) {
+ throw new IllegalArgumentException(String.format(
+ "Type %s not supported by OData version %s", type.toString(), version));
+ }
+ if (type == EdmPrimitiveTypeKind.Stream) {
+ throw new IllegalArgumentException(String.format(
+ "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
+ }
+ if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
+ throw new IllegalArgumentException(
+ type + "is not an instantiable type. "
+ + "An entity can declare a property to be of type Geometry. "
+ + "An instance of an entity MUST NOT have a value of type Geometry. "
+ + "Each value MUST be of some subtype.");
+ }
+
+ getInstance().typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
+ getInstance().type = EdmPrimitiveTypeFactory.getInstance(getInstance().typeKind);
+
+ return this;
+ }
+
+ @Override
+ public AbstractBuilder setText(final String text) {
+ getInstance().text = text;
+ return this;
+ }
+
+ @Override
+ public AbstractBuilder setValue(final Object value) {
+ getInstance().value = value;
+ return this;
+ }
+
+ @Override
+ public AbstractODataPrimitiveValue build() {
+ if (getInstance().text == null && getInstance().value == null) {
+ throw new IllegalArgumentException("Must provide either text or value");
+ }
+ if (getInstance().text != null && getInstance().value != null) {
+ throw new IllegalArgumentException("Cannot provide both text and value");
+ }
+
+ if (getInstance().type == null) {
+ setType(EdmPrimitiveTypeKind.String);
+ }
+
+ if (getInstance().text != null) {
+ final Class<?> returnType = getInstance().type.getDefaultType().isAssignableFrom(Calendar.class)
+ ? Timestamp.class : getInstance().type.getDefaultType();
+ try {
+ // TODO: when Edm is available, set facets when calling this method
+ getInstance().value = getInstance().type.valueOfString(
+ getInstance().text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
+ returnType);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ if (getInstance().value != null) {
+ try {
+ // TODO: when Edm is available, set facets when calling this method
+ getInstance().text = getInstance().type.valueToString(
+ getInstance().value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ return getInstance();
+ }
+ }
+
+ /**
+ * Type kind.
+ */
+ private EdmPrimitiveTypeKind typeKind;
+
+ /**
+ * Type.
+ */
+ private EdmPrimitiveType type;
+
+ /**
+ * Text value.
+ */
+ private String text;
+
+ /**
+ * Actual value.
+ */
+ private Object value;
+
+ protected AbstractODataPrimitiveValue() {
+ super(null);
+ }
+
+ @Override
+ public String getTypeName() {
+ return typeKind.getFullQualifiedName().toString();
+ }
+
+ @Override
+ public EdmPrimitiveTypeKind getTypeKind() {
+ return typeKind;
+ }
+
+ @Override
+ public EdmPrimitiveType getType() {
+ return type;
+ }
+
+ @Override
+ public Object toValue() {
+ return this.value;
+ }
+
+ @Override
+ public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
+ return typeKind.isGeospatial()
+ ? reference.cast(this.value)
+ // TODO: when Edm is available, set facets when calling this method
+ : type.valueOfString(this.text,
+ null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, reference);
+ }
+
+ @Override
+ public String toString() {
+ return this.text;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
index c68dfab..532303c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
@@ -22,8 +22,6 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
@@ -114,16 +112,6 @@ public abstract class AbstractODataProperty implements CommonODataProperty {
}
/**
- * Gets complex value.
- *
- * @return complex value if exists; null otherwise.
- */
- @Override
- public ODataComplexValue getComplexValue() {
- return hasComplexValue() ? this.value.asComplex() : null;
- }
-
- /**
* Checks if has collection value.
*
* @return 'TRUE' if has collection value; 'FALSE' otherwise.
@@ -134,16 +122,6 @@ public abstract class AbstractODataProperty implements CommonODataProperty {
}
/**
- * Gets collection value.
- *
- * @return collection value if exists; null otherwise.
- */
- @Override
- public ODataCollectionValue getCollectionValue() {
- return hasCollectionValue() ? this.value.asCollection() : null;
- }
-
- /**
* {@inheritDoc }
*/
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
deleted file mode 100644
index 1189aae..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
+++ /dev/null
@@ -1,90 +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.commons.core.domain;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.olingo.commons.api.domain.AbstractODataValue;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataValue;
-
-/**
- * OData collection property value.
- */
-public class ODataCollectionValueImpl extends AbstractODataValue implements ODataCollectionValue {
-
- private static final long serialVersionUID = -3665659846001987187L;
-
- /**
- * Values.
- */
- private final List<ODataValue> values = new ArrayList<ODataValue>();
-
- /**
- * Constructor.
- *
- * @param typeName type name.
- */
- public ODataCollectionValueImpl(final String typeName) {
- super(typeName);
- }
-
- /**
- * Adds a value to the collection.
- *
- * @param value value to be added.
- */
- @Override
- public void add(final ODataValue value) {
- if (value.isPrimitive() || value.isComplex()) {
- values.add(value);
- }
- }
-
- /**
- * Value iterator.
- *
- * @return value iterator.
- */
- @Override
- public Iterator<ODataValue> iterator() {
- return values.iterator();
- }
-
- /**
- * Gets collection size.
- *
- * @return collection size.
- */
- @Override
- public int size() {
- return values.size();
- }
-
- /**
- * Checks if collection is empty.
- *
- * @return 'TRUE' if empty; 'FALSE' otherwise.
- */
- @Override
- public boolean isEmpty() {
- return values.isEmpty();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
deleted file mode 100644
index ba8fe56..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
+++ /dev/null
@@ -1,89 +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.commons.core.domain;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.olingo.commons.api.domain.AbstractODataValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-
-/**
- * OData complex property value.
- */
-public class ODataComplexValueImpl extends AbstractODataValue implements ODataComplexValue {
-
- private static final long serialVersionUID = -1878555027714020431L;
-
- /**
- * Complex type fields.
- */
- private final Map<String, CommonODataProperty> fields = new LinkedHashMap<String, CommonODataProperty>();
-
- /**
- * Constructor.
- *
- * @param typeName type name.
- */
- public ODataComplexValueImpl(final String typeName) {
- super(typeName);
- }
-
- /**
- * Adds field to the complex type.
- *
- * @param field field to be added.
- */
- @Override
- public void add(final CommonODataProperty field) {
- fields.put(field.getName(), field);
- }
-
- /**
- * Gets field.
- *
- * @param name name of the field to be retrieved.
- * @return requested field.
- */
- @Override
- public CommonODataProperty get(final String name) {
- return fields.get(name);
- }
-
- /**
- * Complex property fields iterator.
- *
- * @return fields iterator.
- */
- @Override
- public Iterator<CommonODataProperty> iterator() {
- return fields.values().iterator();
- }
-
- /**
- * Gets number of fields.
- *
- * @return number of fields.
- */
- @Override
- public int size() {
- return fields.size();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
deleted file mode 100644
index 965d5fc..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
+++ /dev/null
@@ -1,180 +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.commons.core.domain;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.domain.AbstractODataValue;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-public class ODataPrimitiveValueImpl extends AbstractODataValue implements ODataPrimitiveValue {
-
- private static final long serialVersionUID = 8889282662298376036L;
-
- public static class BuilderImpl implements Builder {
-
- private final ODataServiceVersion version;
-
- private final ODataPrimitiveValueImpl instance;
-
- public BuilderImpl(final ODataServiceVersion version) {
- this.version = version;
- this.instance = new ODataPrimitiveValueImpl();
- }
-
- @Override
- public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
- if (type != null && !type.getSupportedVersions().contains(version)) {
- throw new IllegalArgumentException(String.format(
- "Type %s not supported by OData version %s", type.toString(), version));
- }
- if (type == EdmPrimitiveTypeKind.Stream) {
- throw new IllegalArgumentException(String.format(
- "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
- }
- if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
- throw new IllegalArgumentException(
- type + "is not an instantiable type. "
- + "An entity can declare a property to be of type Geometry. "
- + "An instance of an entity MUST NOT have a value of type Geometry. "
- + "Each value MUST be of some subtype.");
- }
-
- this.instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
- this.instance.type = EdmPrimitiveTypeFactory.getInstance(this.instance.typeKind);
-
- return this;
- }
-
- @Override
- public BuilderImpl setText(final String text) {
- this.instance.text = text;
- return this;
- }
-
- @Override
- public BuilderImpl setValue(final Object value) {
- this.instance.value = value;
- return this;
- }
-
- @Override
- public ODataPrimitiveValueImpl build() {
- if (this.instance.text == null && this.instance.value == null) {
- throw new IllegalArgumentException("Must provide either text or value");
- }
- if (this.instance.text != null && this.instance.value != null) {
- throw new IllegalArgumentException("Cannot provide both text and value");
- }
-
- if (this.instance.type == null) {
- setType(EdmPrimitiveTypeKind.String);
- }
-
- if (this.instance.text != null) {
- final Class<?> returnType = this.instance.type.getDefaultType().isAssignableFrom(Calendar.class)
- ? Timestamp.class : this.instance.type.getDefaultType();
- try {
- // TODO: when Edm is available, set facets when calling this method
- this.instance.value = this.instance.type.valueOfString(
- this.instance.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
- returnType);
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException(e);
- }
- }
- if (this.instance.value != null) {
- try {
- // TODO: when Edm is available, set facets when calling this method
- this.instance.text = this.instance.type.valueToString(
- this.instance.value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- return this.instance;
- }
- }
-
- /**
- * Type kind.
- */
- private EdmPrimitiveTypeKind typeKind;
-
- /**
- * Type.
- */
- private EdmPrimitiveType type;
-
- /**
- * Text value.
- */
- private String text;
-
- /**
- * Actual value.
- */
- private Object value;
-
- private ODataPrimitiveValueImpl() {
- super(null);
- }
-
- @Override
- public String getTypeName() {
- return typeKind.getFullQualifiedName().toString();
- }
-
- @Override
- public EdmPrimitiveTypeKind getTypeKind() {
- return typeKind;
- }
-
- @Override
- public EdmPrimitiveType getType() {
- return type;
- }
-
- @Override
- public Object toValue() {
- return this.value;
- }
-
- @Override
- public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
- return typeKind.isGeospatial()
- ? reference.cast(this.value)
- // TODO: when Edm is available, set facets when calling this method
- : type.valueOfString(this.text,
- null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, reference);
- }
-
- @Override
- public String toString() {
- return this.text;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataCollectionValueImpl.java
new file mode 100644
index 0000000..1ebd62a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataCollectionValueImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.core.domain.AbstractODataCollectionValue;
+
+public class ODataCollectionValueImpl extends AbstractODataCollectionValue<ODataValue> {
+
+ private static final long serialVersionUID = 5887168245885401351L;
+
+ public ODataCollectionValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataComplexValueImpl.java
new file mode 100644
index 0000000..4b09fcc
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataComplexValueImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataComplexValue;
+
+public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProperty> {
+
+ private static final long serialVersionUID = 1143925901934898802L;
+
+ public ODataComplexValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
index 2bfb8f5..18f9e13 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
@@ -19,9 +19,11 @@
package org.apache.olingo.commons.core.domain.v3;
import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
@@ -58,17 +60,36 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
}
@Override
+ public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(version);
+ }
+
+ @Override
+ public ODataComplexValue<ODataProperty> newComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ODataCollectionValue<ODataValue> newCollectionValue(final String typeName) {
+ return new ODataCollectionValueImpl(typeName);
+ }
+
+ @Override
public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
return new ODataPropertyImpl(name, value);
}
@Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ public ODataProperty newComplexProperty(final String name,
+ final ODataComplexValue<? extends CommonODataProperty> value) {
+
return new ODataPropertyImpl(name, value);
}
@Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ public ODataProperty newCollectionProperty(final String name,
+ final ODataCollectionValue<? extends ODataValue> value) {
+
return new ODataPropertyImpl(name, value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPrimitiveValueImpl.java
new file mode 100644
index 0000000..6dc3034
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPrimitiveValueImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.AbstractODataPrimitiveValue;
+
+public class ODataPrimitiveValueImpl extends AbstractODataPrimitiveValue {
+
+ private static final long serialVersionUID = -5201738902625613179L;
+
+ public static class BuilderImpl extends AbstractBuilder {
+
+ private final ODataPrimitiveValueImpl instance;
+
+ public BuilderImpl(final ODataServiceVersion version) {
+ super(version);
+ this.instance = new ODataPrimitiveValueImpl();
+ }
+
+ @Override
+ protected AbstractODataPrimitiveValue getInstance() {
+ return instance;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
index 68c44ec..45eb01f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
@@ -18,6 +18,8 @@
*/
package org.apache.olingo.commons.core.domain.v3;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.core.domain.AbstractODataProperty;
@@ -30,4 +32,14 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
super(name, value);
}
+ @Override
+ public ODataComplexValue<ODataProperty> getComplexValue() {
+ return hasComplexValue() ? getValue().<ODataProperty>asComplex() : null;
+ }
+
+ @Override
+ public ODataCollectionValue<ODataValue> getCollectionValue() {
+ return hasCollectionValue() ? getValue().<ODataValue>asCollection() : null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
new file mode 100644
index 0000000..b0e0539
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
@@ -0,0 +1,42 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.core.domain.AbstractODataCollectionValue;
+
+public class ODataCollectionValueImpl extends AbstractODataCollectionValue<ODataValue> implements ODataValue {
+
+ private static final long serialVersionUID = 5887168245885401351L;
+
+ public ODataCollectionValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ODataEnumValue asEnum() {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
new file mode 100644
index 0000000..7c6e72f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.core.domain.AbstractODataComplexValue;
+
+public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProperty> implements ODataValue {
+
+ private static final long serialVersionUID = 1143925901934898802L;
+
+ public ODataComplexValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ODataEnumValue asEnum() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
index 0a84407..4f46a76 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
@@ -19,6 +19,7 @@
package org.apache.olingo.commons.core.domain.v4;
import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
@@ -27,6 +28,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.domain.AbstractODataObjectFactory;
@@ -59,22 +61,41 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
}
@Override
+ public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(version);
+ }
+
+ @Override
public ODataEnumValue newEnumValue(final String typeName, final String value) {
return new ODataEnumValueImpl(typeName, value);
}
@Override
+ public ODataComplexValue<ODataProperty> newComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ODataCollectionValue<ODataValue> newCollectionValue(final String typeName) {
+ return new ODataCollectionValueImpl(typeName);
+ }
+
+ @Override
public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
return new ODataPropertyImpl(name, value);
}
@Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ public ODataProperty newComplexProperty(final String name,
+ final ODataComplexValue<? extends CommonODataProperty> value) {
+
return new ODataPropertyImpl(name, value);
}
@Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ public ODataProperty newCollectionProperty(final String name,
+ final ODataCollectionValue<? extends org.apache.olingo.commons.api.domain.ODataValue> value) {
+
return new ODataPropertyImpl(name, value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
new file mode 100644
index 0000000..0d7ace8
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
@@ -0,0 +1,56 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.AbstractODataPrimitiveValue;
+
+public class ODataPrimitiveValueImpl extends AbstractODataPrimitiveValue implements ODataValue {
+
+ private static final long serialVersionUID = -5201738902625613179L;
+
+ public static class BuilderImpl extends AbstractBuilder {
+
+ private final ODataPrimitiveValueImpl instance;
+
+ public BuilderImpl(final ODataServiceVersion version) {
+ super(version);
+ this.instance = new ODataPrimitiveValueImpl();
+ }
+
+ @Override
+ protected AbstractODataPrimitiveValue getInstance() {
+ return instance;
+ }
+
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ODataEnumValue asEnum() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
index fe6bf9d..85cdf67 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
@@ -18,8 +18,11 @@
*/
package org.apache.olingo.commons.core.domain.v4;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.core.domain.AbstractODataProperty;
public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty {
@@ -41,4 +44,14 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
return hasEnumValue() ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asEnum() : null;
}
+ @Override
+ public ODataComplexValue<ODataProperty> getComplexValue() {
+ return hasComplexValue() ? getValue().<ODataProperty>asComplex() : null;
+ }
+
+ @Override
+ public ODataCollectionValue<ODataValue> getCollectionValue() {
+ return hasCollectionValue() ? getValue().<ODataValue>asCollection() : null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6b0668b..01136c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -231,6 +231,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
+ <configuration>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
[27/51] [abbrv] [OLINGO-227] fix minor xml issues
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml b/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml
index cef8ad6..79b934b 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml b/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml
index d749910..be808a3 100644
--- a/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml
+++ b/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,27 +19,6 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Customer</id>
<title type="text">Customer</title>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml b/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml
index 6653876..e836bd1 100644
--- a/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml
+++ b/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml
@@ -1,25 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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.
-->
-<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/InStreamErrorGetCustomer</id>
<title type="text">InStreamErrorGetCustomer</title>
<updated>2014-02-12T14:03:09Z</updated>
@@ -28,18 +30,25 @@
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Customer(-10)</id>
<category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Customer" href="Customer(-10)" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="Customer(-10)/Orders" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Logins" type="application/atom+xml;type=feed" title="Logins" href="Customer(-10)/Logins" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Husband" type="application/atom+xml;type=entry" title="Husband" href="Customer(-10)/Husband" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Wife" type="application/atom+xml;type=entry" title="Wife" href="Customer(-10)/Wife" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Info" type="application/atom+xml;type=entry" title="Info" href="Customer(-10)/Info" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders" type="application/atom+xml;type=feed"
+ title="Orders" href="Customer(-10)/Orders" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Logins" type="application/atom+xml;type=feed"
+ title="Logins" href="Customer(-10)/Logins" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Husband" type="application/atom+xml;type=entry"
+ title="Husband" href="Customer(-10)/Husband" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Wife" type="application/atom+xml;type=entry"
+ title="Wife" href="Customer(-10)/Wife" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Info" type="application/atom+xml;type=entry"
+ title="Info" href="Customer(-10)/Info" />
<title />
- <summary type="text">commastartedtotalnormaloffsetsregisteredgroupcelestialexposureconventionsimportcastclass</summary>
+ <summary type="text">commastartedtotalnormaloffsetsregisteredgroupcelestialexposureconventionsimportcastclass
+ </summary>
<updated>2014-02-12T14:03:09Z</updated>
<author>
<name />
</author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Thumbnail" title="Thumbnail" href="Customer(-10)/Thumbnail" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Thumbnail" title="Thumbnail"
+ href="Customer(-10)/Thumbnail" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Customer(-10)/Video" />
<content type="application/xml">
<m:properties>
@@ -52,14 +61,16 @@
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>グぁマせぺネソぁぼソひバたぴソ歹九ネボボяポソ畚クяせべ歹珱Я欲タハバミ裹ぼボをヲ歹んひ九ひ匚ぁa</d:element>
- <d:element>qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta</d:element>
+ <d:element>qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta
+ </d:element>
<d:element>btsnhqrjqryqzgxducl</d:element>
<d:element>qbtlssjhunufmzdv</d:element>
<d:element>ボんЯぜチべゼボボほa匚ミぼ九ぁひチ珱黑ミんぁタび暦クソソボゾんんあゼぞひタボタぜん弌ひべ匚</d:element>
<d:element>vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae</d:element>
<d:element>九ソミせボぜゾボёaをぜЯまゾタぜタひ縷ダんaバたゼソ</d:element>
<d:element>ぽマタぁぁ黑ソゼミゼ匚zソダマぁァゾぽミaタゾ弌ミゼタそzぺポせ裹バポハハヲぺチあマ匚ミ</d:element>
- <d:element>hssiißuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbdßjnelxqttkhdalabibuqhiubtßsptrmzelud</d:element>
+ <d:element>hssiißuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbdßjnelxqttkhdalabibuqhiubtßsptrmzelud
+ </d:element>
<d:element>gbjssllxzzxkmßppyyrhgmoeßizlcmsuqqnvjßudszevtfunflqzqcuubukypßqjcix</d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
@@ -69,18 +80,23 @@
<d:element>esgmrxddisdvykgttpmizcethjuazqxemuossopssaqpmqdßkayrrocgsxqpo</d:element>
<d:element>クソ珱べをマんグハひボソソんミソソゼンぞたぼzミ歹ぴ</d:element>
<d:element>ljrggbaseqsrkelksvhouoscmoilogibae</d:element>
- <d:element>そぜぜママゼミぼゼボべソほあんせひびゼミソ弌ほそタボマチタマソネ弌チポ匚まソゾマЯЯたゾ裹あ畚ん弌た珱畚マЯソァ珱ネびё九たミミぴぺポマゼダ弌ミマママソボ亜ぺソ匚グ弌グ歹ハま匚そん黑ん</d:element>
- <d:element>ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl</d:element>
- <d:element>たёタЯяまひぺァ暦ソマポハクタせたひァ暦ヲ九暦ぞぜチ匚欲ゼほ九ぺ畚びぞポボクぴをチチそボソマポんぽミァ弌ァぞぴまミ縷黑ミゼゼzチミソ暦ゼほ畚ソ匚ネёほゼボぴポゼ縷ソチポ裹ヲ縷九ン歹a九ソソ</d:element>
+ <d:element>そぜぜママゼミぼゼボべソほあんせひびゼミソ弌ほそタボマチタマソネ弌チポ匚まソゾマЯЯたゾ裹あ畚ん弌た珱畚マЯソァ珱ネびё九たミミぴぺポマゼダ弌ミマママソボ亜ぺソ匚グ弌グ歹ハま匚そん黑ん
+ </d:element>
+ <d:element>ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl
+ </d:element>
+ <d:element>たёタЯяまひぺァ暦ソマポハクタせたひァ暦ヲ九暦ぞぜチ匚欲ゼほ九ぺ畚びぞポボクぴをチチそボソマポんぽミァ弌ァぞぴまミ縷黑ミゼゼzチミソ暦ゼほ畚ソ匚ネёほゼボぴポゼ縷ソチポ裹ヲ縷九ン歹a九ソソ
+ </d:element>
</d:AlternativeNames>
</d:ContactAlias>
<d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
- <d:PhoneNumber>畚ぼせゼぽチ欲を縷弌ポタぺゾ欲a歹まマ亜チぁゼゼaマァゾぞあ弌そをポダボグびゼァたチ珱べぴゼタzボネァァ歹ぞゼ欲欲マソチぺんび暦ンタぺダzぴダポ縷ァボЯべぺべタびグ珱たミソぽひぼミ暦マミ歹そ欲ゼёべポ</d:PhoneNumber>
+ <d:PhoneNumber>畚ぼせゼぽチ欲を縷弌ポタぺゾ欲a歹まマ亜チぁゼゼaマァゾぞあ弌そをポダボグびゼァたチ珱べぴゼタzボネァァ歹ぞゼ欲欲マソチぺんび暦ンタぺダzぴダポ縷ァボЯべぺべタびグ珱たミソぽひぼミ暦マミ歹そ欲ゼёべポ
+ </d:PhoneNumber>
<d:Extension>jqjklhnnkyhujailcedbguyectpuamgbghreatqvobbtj</d:Extension>
</d:HomePhone>
<d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
<d:PhoneNumber>そマ弌あハミゼぼマ匚ソバzチぴソぁんёタゾゼソせぴボひハネゼぽべァたぺゾチァそ</d:PhoneNumber>
- <d:Extension>erpdbdvgezuztcsyßpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkadeßustxßf</d:Extension>
+ <d:Extension>erpdbdvgezuztcsyßpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkadeßustxßf
+ </d:Extension>
</d:WorkPhone>
<d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
<d:element>
@@ -104,7 +120,8 @@
<d:Extension>aゾ暦ヲaゾをチёゼをぽァ亜ぽひぞポ裹ぼぜゼソミネミ暦ぽぽべべミ匚aぞチボネヲ黑暦たほタクチダё珱ネををチソ</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu</d:PhoneNumber>
+ <d:PhoneNumber>bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu
+ </d:PhoneNumber>
<d:Extension>
</d:Extension>
</d:element>
@@ -117,7 +134,8 @@
<d:Extension>バゼぼクグ</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>zチ亜ネンaバそ珱グせ亜ンネヲん歹ま亜aポタミぜ弌珱ミゼЯほんボ裹я九ぁァ珱ぼクゼポネァネ珱ゼまゼあハマまネぼゼ歹ポぴたべべそボぁソ珱ヲぺ黑ンネёゼダЯタゼそzソソンzボボァ黑匚んべポポ</d:PhoneNumber>
+ <d:PhoneNumber>zチ亜ネンaバそ珱グせ亜ンネヲん歹ま亜aポタミぜ弌珱ミゼЯほんボ裹я九ぁァ珱ぼクゼポネァネ珱ゼまゼあハマまネぼゼ歹ポぴたべべそボぁソ珱ヲぺ黑ンネёゼダЯタゼそzソソンzボボァ黑匚んべポポ
+ </d:PhoneNumber>
<d:Extension>gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg</d:Extension>
</d:element>
</d:MobilePhoneBag>
@@ -127,22 +145,27 @@
<d:EmailBag m:type="Collection(Edm.String)" />
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>まミボあ弌ミんヲをミグミをzソボソポタzべ裹タ畚グぁ暦また裹九ぽマそ九ぽ歹ゼ九マソたそマЯぽぜゼゼ暦ハハバ珱ダグぴ亜マミaя欲ゼヲぜЯぴぴひ弌ё黑歹ゾあ</d:element>
- <d:element>ぜヲグ畚ァをたポ珱チグああミЯ亜ゼァミミ黑ぽ裹ぺぼЯダマ匚ァゾハァ裹ハ匚ダたゾぜ暦ソひボ欲せミん黑ああ九せそz歹ぁたボァ九ソ縷ゾせ弌ミびぞぺべぽ珱バ黑ソそまゼひをほ亜マぽミゾ</d:element>
+ <d:element>ぜヲグ畚ァをたポ珱チグああミЯ亜ゼァミミ黑ぽ裹ぺぼЯダマ匚ァゾハァ裹ハ匚ダたゾぜ暦ソひボ欲せミん黑ああ九せそz歹ぁたボァ九ソ縷ゾせ弌ミびぞぺべぽ珱バ黑ソそまゼひをほ亜マぽミゾ
+ </d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>uhgnrnahnbsyvzlbltutlemsbcgdlchlxtsdpzkthvueixlxaelaq</d:element>
- <d:element>pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp</d:element>
+ <d:element>pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp
+ </d:element>
<d:element>eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi</d:element>
- <d:element>ёЯポぞミ暦亜タァぜ珱Яゼ縷ミボぜポハぺバまポぴたゾソチチァポま畚ひネネクンタせゾソポあゼぜё九ネべぽゼぁハま九ァソンぼクべヲЯゼチぞぽ黑九ぽそぞゾミぞボバ弌ぁソマチクあぼほま畚</d:element>
- <d:element>adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukrßßßirygjzsssktizcikerysklohuonekujmutsxuvdbacrj</d:element>
+ <d:element>ёЯポぞミ暦亜タァぜ珱Яゼ縷ミボぜポハぺバまポぴたゾソチチァポま畚ひネネクンタせゾソポあゼぜё九ネべぽゼぁハま九ァソンぼクべヲЯゼチぞぽ黑九ぽそぞゾミぞボバ弌ぁソマチクあぼほま畚
+ </d:element>
+ <d:element>adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukrßßßirygjzsssktizcikerysklohuonekujmutsxuvdbacrj
+ </d:element>
<d:element>uahsvudmlßdtbxxm</d:element>
<d:element>yulcdchqqcvrrmzhaeens</d:element>
<d:element>vxiefursgkqzptijhincpdm</d:element>
</d:AlternativeNames>
</d:ContactAlias>
<d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
- <d:PhoneNumber>jlessdhjbgglmofcyßucßqbrfßppgzvygdyssßpehkrdetitmßfddsplccvussrvidmkodchdfzjvfgossbciq</d:PhoneNumber>
+ <d:PhoneNumber>jlessdhjbgglmofcyßucßqbrfßppgzvygdyssßpehkrdetitmßfddsplccvussrvidmkodchdfzjvfgossbciq
+ </d:PhoneNumber>
<d:Extension m:null="true" />
</d:HomePhone>
<d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
@@ -167,7 +190,8 @@
<d:Extension>zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>ヲa珱ぺ亜ヲぜそゾタクせクソ珱黑チぴチぽ裹チЯマ歹マゼをァんをネをバクンびЯ九ほzひせaタをせボバチボタタソЯゼaたグあダ弌匚びべゼ弌九あ珱九チソァァミゾあびダバ弌マ九マ弌ソ珱ハヲあ</d:PhoneNumber>
+ <d:PhoneNumber>ヲa珱ぺ亜ヲぜそゾタクせクソ珱黑チぴチぽ裹チЯマ歹マゼをァんをネをバクンびЯ九ほzひせaタをせボバチボタタソЯゼaたグあダ弌匚びべゼ弌九あ珱九チソァァミゾあびダバ弌マ九マ弌ソ珱ハヲあ
+ </d:PhoneNumber>
<d:Extension m:null="true" />
</d:element>
<d:element>
@@ -208,10 +232,12 @@
</d:element>
<d:element>
<d:PhoneNumber>bxtoaigdgqpgavbzgogumavofjilq</d:PhoneNumber>
- <d:Extension>tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem</d:Extension>
+ <d:Extension>tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem
+ </d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>apbncxdjnßyekauytgtpypccamximepvmhtkßxtxkujussßayfsockssyjgßntßbzlheneffyzp</d:PhoneNumber>
+ <d:PhoneNumber>apbncxdjnßyekauytgtpypccamximepvmhtkßxtxkujussßayfsockssyjgßntßbzlheneffyzp
+ </d:PhoneNumber>
<d:Extension>ゾまяゾネ弌暦zァクチゾをぜЯまЯ</d:Extension>
</d:element>
</d:MobilePhoneBag>
@@ -226,7 +252,8 @@
<d:element>をポソァ黑ミク珱ゼぁЯゼチ欲zaぽボ九バマ</d:element>
<d:element>ソタゼz黑ァёzマタべグぺゼミ匚べぁせゼЯゼま暦ゼァソァぞァタё亜ミ畚ゼんゼzぜЯぁマぁボチミ珱aヲゼポびゾマяぺチタチ裹ミ暦ァЯひボゾダん</d:element>
<d:element>ネゼヲミほぴ珱バチゼ</d:element>
- <d:element>珱ぽё歹ひ九縷グべをぼクёソzほんボゾボダぴせミんンゼマヲんんボゼたんァソマたミ黑ミ匚そマクべ九裹グぼ弌ポをんポぴんタびァぴゼ縷ンバa縷たバ弌ボソ弌マ暦ゼヲяヲ弌ポ匚チあタ</d:element>
+ <d:element>珱ぽё歹ひ九縷グべをぼクёソzほんボゾボダぴせミんンゼマヲんんボゼたんァソマたミ黑ミ匚そマクべ九裹グぼ弌ポをんポぴんタびァぴゼ縷ンバa縷たバ弌ボソ弌マ暦ゼヲяヲ弌ポ匚チあタ
+ </d:element>
<d:element>poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx</d:element>
<d:element>ndtimxyzurßjulzbssqidhqzd</d:element>
<d:element>nrahrsjzgmßgifzsssefcyotsdtoyzhkkßggdudfttppsßfak</d:element>
@@ -244,9 +271,11 @@
</d:element>
<d:element>
<d:EmailBag m:type="Collection(Edm.String)">
- <d:element>mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh</d:element>
+ <d:element>mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh
+ </d:element>
<d:element>九ソ</d:element>
- <d:element>kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld</d:element>
+ <d:element>kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld
+ </d:element>
<d:element>ァぴたァタチほゼaぜミ亜ソa暦ダあ珱あゾЯんゼン縷暦ミaま珱ゼ珱ミポ弌ポソa縷亜亜チ縷チゾポ弌あポ九ゼソ</d:element>
<d:element>auuksxfiesyauouoossftkjxlcardnjßdhuuydlbzklvyqqassm</d:element>
<d:element>cpinxqbruemprnqpgcupthdynzvpasrxokaseuzndkshxuuay</d:element>
@@ -255,7 +284,8 @@
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>hpkfvttvhputllugyzvpvutsebq</d:element>
- <d:element>mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkajßfpxupzupyubpentjqlicmugfcsvmkasseckmtqfk</d:element>
+ <d:element>mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkajßfpxupzupyubpentjqlicmugfcsvmkasseckmtqfk
+ </d:element>
<d:element>tifzmfygußssbkmcnzyiroybogp</d:element>
<d:element>ァёチ歹ぼяまンァびタボそぼンそぁяネゾせクチゼミた縷畚ぴチzぽ裹チゼaグァぴタヲダハマハぁЯバべяをチぁゾマネゾひそぜたゼ暦亜ほほミダ欲ぁミミ歹ソダタ匚</d:element>
<d:element>ぞぽポひぽゼぺゼ縷ソソぺぺせグチ九歹ソァァソ弌たをチミハzたべボァソネ畚九ボゾ珱яをポグバゾゾ九ぜン弌aゼソァポゾゾ畚マポボソ九ほ欲裹</d:element>
@@ -271,7 +301,8 @@
</d:ContactAlias>
<d:HomePhone m:null="true" />
<d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
- <d:PhoneNumber>gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu</d:PhoneNumber>
+ <d:PhoneNumber>gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu
+ </d:PhoneNumber>
<d:Extension>ソzび弌ゼん亜グマ歹</d:Extension>
</d:WorkPhone>
<d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" />
@@ -296,7 +327,8 @@
</d:ContactAlias>
<d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
<d:PhoneNumber m:null="true" />
- <d:Extension>xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmucßußimsskclaoxßgmpdbikuopezdassivchc</d:Extension>
+ <d:Extension>xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmucßußimsskclaoxßgmpdbikuopezdassivchc
+ </d:Extension>
</d:HomePhone>
<d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
<d:PhoneNumber>ldgui</d:PhoneNumber>
@@ -305,7 +337,8 @@
<d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
<d:element>
<d:PhoneNumber>亜ゼバネぺ歹ダ亜ぴあをaゼをぼ歹ぼЯま歹タяタそバぽяま九z弌ン歹そЯポミマボをёソぼぽびゼゾ裹ゼaa</d:PhoneNumber>
- <d:Extension>rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs</d:Extension>
+ <d:Extension>rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs
+ </d:Extension>
</d:element>
<d:element>
<d:PhoneNumber m:null="true" />
@@ -320,7 +353,8 @@
<d:Extension>ぜゾゾ</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu</d:PhoneNumber>
+ <d:PhoneNumber>uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu
+ </d:PhoneNumber>
<d:Extension>fqsrtdßqkzfxkzßlßbuhuqgttjpuzzmcyußecfczkpsslhzssbzybgtulsfsszfrbt</d:Extension>
</d:element>
<d:element>
@@ -328,8 +362,10 @@
<d:Extension>yqczpmgvcxajmiucgrucmcnquycepqr</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>ひ縷グひ匚バソ亜ぽを九まあヲ縷びタ歹九マぁハ弌ミまをほチぺママゾほяぜゾァマソヲ暦歹グ縷びネЯマ弌タ匚黑ァび亜チぜポ畚ソク縷タチバぼёぁ珱ゼ歹珱ク匚縷ぺべ裹ダんをダ</d:PhoneNumber>
- <d:Extension>ひあぼタグポ暦Яバaん暦ま黑aヲ歹グマ黑チダまダグぴぜチひ欲ぜ欲ポ欲ぜネ弌ァёひёクびヲ裹ゼバボグァミゼяЯぺボ匚ミたびチぼ歹弌歹ゾひソ欲ヲひゾァタ縷ぴグァ</d:Extension>
+ <d:PhoneNumber>ひ縷グひ匚バソ亜ぽを九まあヲ縷びタ歹九マぁハ弌ミまをほチぺママゾほяぜゾァマソヲ暦歹グ縷びネЯマ弌タ匚黑ァび亜チぜポ畚ソク縷タチバぼёぁ珱ゼ歹珱ク匚縷ぺべ裹ダんをダ
+ </d:PhoneNumber>
+ <d:Extension>ひあぼタグポ暦Яバaん暦ま黑aヲ歹グマ黑チダまダグぴぜチひ欲ぜ欲ポ欲ぜネ弌ァёひёクびヲ裹ゼバボグァミゼяЯぺボ匚ミたびチぼ歹弌歹ゾひソ欲ヲひゾァタ縷ぴグァ
+ </d:Extension>
</d:element>
<d:element>
<d:PhoneNumber>xisvqplbibxpvmhojc</d:PhoneNumber>
@@ -344,7 +380,8 @@
<d:element>edbuyltmaulsssuhssajuudevlpdslveßmtoaubhassqca</d:element>
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
- <d:element>uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse</d:element>
+ <d:element>uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse
+ </d:element>
<d:element>uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv</d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
@@ -359,7 +396,8 @@
</d:WorkPhone>
<d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
<d:element>
- <d:PhoneNumber>quxqrsssklmvhßfqcitdßßvrvbidqxrnejcaqßbzßueupmzjylßsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu</d:PhoneNumber>
+ <d:PhoneNumber>quxqrsssklmvhßfqcitdßßvrvbidqxrnejcaqßbzßueupmzjylßsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu
+ </d:PhoneNumber>
<d:Extension>ぽせソァボ亜ヲボチソ九暦マまマёびゼ亜そ裹まaミ畚aをぁタそ珱</d:Extension>
</d:element>
<d:element>
@@ -375,9 +413,11 @@
<d:element>fuhhjrnhnoßukpvrduzzzmexrnmuipuegcvviclzknajssrdhdassahsxuintyovdßßzkcvanefa</d:element>
<d:element>rzßfuliqusqhesnlpuqfejacapdlzsgclfkqunssgbgvcvxu</d:element>
<d:element>マほ珱あゼほ縷ミまチぴバミソァゼ縷九ぼaミё欲まぜマバ暦ゼび欲ネソァЯぜクゼ畚べ九яまグたチボク縷ゼヲЯёぁ歹ポ</d:element>
- <d:element>tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmußyozßkkrhufzssdtyoncatlmßpvbivfdqsrssnhktgßlbmjd</d:element>
+ <d:element>tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmußyozßkkrhufzssdtyoncatlmßpvbivfdqsrssnhktgßlbmjd
+ </d:element>
<d:element>hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu</d:element>
- <d:element>ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm</d:element>
+ <d:element>ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm
+ </d:element>
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>uekkpqeravjss</d:element>
@@ -386,7 +426,8 @@
<d:element>pmsrknzeo</d:element>
<d:element>ほ弌ぜぁボ珱たをёァぴゼグぺバぜソ裹た珱ソяクた亜ほタネチクあボzンミぁせボソ匚ソそぁほァをぽぺヲ欲バべゾёまぺソzまグァびミマぽダソゼゾチЯ欲</d:element>
<d:element>gssovkßfautyuzsmqogekdjhßuxytjvvtoqssdfoxj</d:element>
- <d:element>yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu</d:element>
+ <d:element>yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu
+ </d:element>
<d:element>rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi</d:element>
<d:element>縷ほ匚ダ弌縷せЯяぽゼヲンそaタぺチそをバタハひポダ歹ネ裹ポひ縷ゾマたァマ裹そゾせソそゾせポせ暦ゼ</d:element>
<d:element>oqygrqyceoohomkfßpvgkqcujiiakangcquyvvsiaykßgthnbvxv</d:element>
@@ -413,11 +454,13 @@
</d:element>
<d:element>
<d:PhoneNumber>xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums</d:PhoneNumber>
- <d:Extension>zxqxnmuxdlizjdjkuckovjbhkqomjcxnnzßruvoßaypbcaiqjipssujimrdhsshqkarmhmftsgokossxßokmmofryv</d:Extension>
+ <d:Extension>zxqxnmuxdlizjdjkuckovjbhkqomjcxnnzßruvoßaypbcaiqjipssujimrdhsshqkarmhmftsgokossxßokmmofryv
+ </d:Extension>
</d:element>
<d:element>
<d:PhoneNumber>ソたバグゼチチマポチァポゼほ暦をまぞママぞaソ珱タひァ匚ミほミ欲九べ黑ネ歹亜ダほゼソ弌aぴソ縷ゼあ</d:PhoneNumber>
- <d:Extension>をクゾマ亜珱ぼほ弌ヲゼ畚ゾ黑べァ歹ソタチソをマたタポあぽ黑ミぺゼЯяソ珱ゼませ裹をЯボゾゼぁマダポぜほёをぞクンポクびせ弌ネんせミン珱ソソク黑ダグボぽゼマべ亜ソ</d:Extension>
+ <d:Extension>をクゾマ亜珱ぼほ弌ヲゼ畚ゾ黑べァ歹ソタチソをマたタポあぽ黑ミぺゼЯяソ珱ゼませ裹をЯボゾゼぁマダポぜほёをぞクンポクびせ弌ネんせミン珱ソソク黑ダグボぽゼマべ亜ソ
+ </d:Extension>
</d:element>
<d:element>
<d:PhoneNumber>ぴぜ縷ポソびぁぜンそァマダ九ゼべぺせんびマポマ珱aんソハミそぽグゾハダ縷ネ暦Яび畚ソゼゾaミたソ</d:PhoneNumber>
@@ -428,7 +471,8 @@
<d:Extension>べぼ畚ёァクひんチまぼそタヲマぺzタЯ畚ァたべёをァべポ黑び九タzポネ亜グゼЯゾaダぺミべ欲タ裹匚ぴそンボ</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj</d:PhoneNumber>
+ <d:PhoneNumber>szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj
+ </d:PhoneNumber>
<d:Extension>匚びチゼ珱ゾ</d:Extension>
</d:element>
<d:element>
@@ -436,7 +480,8 @@
<d:Extension>fgbypkdxßiycssbbcnapiulvsnaae</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp</d:PhoneNumber>
+ <d:PhoneNumber>ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp
+ </d:PhoneNumber>
<d:Extension>ゾネマ欲珱歹バタそミんをひ弌クゾひソヲぞマゼぴべグzzぺ</d:Extension>
</d:element>
<d:element>
@@ -447,19 +492,23 @@
</d:element>
<d:element>
<d:EmailBag m:type="Collection(Edm.String)">
- <d:element>gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce</d:element>
+ <d:element>gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce
+ </d:element>
<d:element>umasbyxqmedmmmktttuqzojcuellbbvlttfucyeuxazppokukgj</d:element>
<d:element>meoupujjkhbvuucrnxtrußovqepgaxtqyfdftlgytlnqkxhs</d:element>
<d:element>バタヲミダaんたタチせゼバボチ裹ゾソa黑ぜゾ珱黑まゼゾァ匚マ畚グぴёぞせaハミクゼん欲をポせヲя縷z畚ほя黑ミぜポёゼたソング歹ミマべチゾソネ裹ミチタ弌マダぼべソ</d:element>
- <d:element>vqhdfejyupzjssßpssyhnjßßlkjzjovcsßnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc</d:element>
+ <d:element>vqhdfejyupzjssßpssyhnjßßlkjzjovcsßnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc
+ </d:element>
<d:element>せマひゾ縷ポあタポぴヲゼぁ珱欲匚ネ暦ま亜ぺソ亜ソポグ裹歹ポネバ</d:element>
<d:element>fxonebvfsslbxdcnxjeaipyrulsbvqnuckmxpgsexvrzyjkpmieurukqz</d:element>
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>qlebgßjtgznrßicssssuhauruqjlißysscpcqdhqvple</d:element>
<d:element>llrecraphldysjtx</d:element>
- <d:element>jsßkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu</d:element>
- <d:element>んをグマまァミほぽ弌aぽぺ暦珱ё九ぁ九せゼヲソヲぺバミママまzヲダゼ黑ァミ裹ダぁぁあゾぺべァaゾヲソぜぜ弌ポタク歹ゼソマボёダネ珱ネミ暦裹ゾを歹ゾマёァゾほ亜縷マぺ九ぺび珱び裹縷チタんソ</d:element>
+ <d:element>jsßkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu
+ </d:element>
+ <d:element>んをグマまァミほぽ弌aぽぺ暦珱ё九ぁ九せゼヲソヲぺバミママまzヲダゼ黑ァミ裹ダぁぁあゾぺべァaゾヲソぜぜ弌ポタク歹ゼソマボёダネ珱ネミ暦裹ゾを歹ゾマёァゾほ亜縷マぺ九ぺび珱び裹縷チタんソ
+ </d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
<d:AlternativeNames m:type="Collection(Edm.String)" />
@@ -476,29 +525,34 @@
</d:element>
<d:element>
<d:EmailBag m:type="Collection(Edm.String)">
- <d:element>lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz</d:element>
+ <d:element>lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz
+ </d:element>
<d:element>ёひzяぽタびミゼ縷ゾЯん九匚ソマソゼをべゼクタ縷ハバぴ亜畚ミゾべaソ弌マЯネァタaぼ</d:element>
<d:element>ネそバポあゾゾソぺポ暦ゼぞマaンヲタひネ暦ゼまン亜マゾ</d:element>
<d:element>ぞaポバボゾチぜ弌ほЯ亜ミ欲ネぽ畚をゼタヲ九ま裹ソハ歹ボ裹</d:element>
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>ssmyumekjytzßeskalxbrdghruoarssbjcpiufomgcßiiahzkzhqjnvtjpocßhaulrf</d:element>
- <d:element>zuzßlsssuchfxsodgvxkysbuymßbbqksrnlactkixechussuszmoykcmdtßakmulnvrqfcoepgupvlxjssgffsmnckacfdtß</d:element>
+ <d:element>zuzßlsssuchfxsodgvxkysbuymßbbqksrnlactkixechussuszmoykcmdtßakmulnvrqfcoepgupvlxjssgffsmnckacfdtß
+ </d:element>
<d:element>qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp</d:element>
<d:element>ßsqumolßqckqhssnecyhssnjicmvzkußrlyhmngyasxkuk</d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>esspxmnhprbevpmzsajargvrooqpecucumxxrbkzyybdktnoxbkzbcvrxel</d:element>
- <d:element>ァゼ裹a畚まミポまタタソё匚そチべァタタ亜歹亜珱ёzマぴяボママぜяハ歹ゼチ黑をゼほ黑ネソ匚ぴせハァ珱ぴぼクひゾボё縷黑バダボボ欲歹ァяびまたポソぺぞタ黑匚ゼぽ九バハマ弌タソミ珱ぜべグマン</d:element>
+ <d:element>ァゼ裹a畚まミポまタタソё匚そチべァタタ亜歹亜珱ёzマぴяボママぜяハ歹ゼチ黑をゼほ黑ネソ匚ぴせハァ珱ぴぼクひゾボё縷黑バダボボ欲歹ァяびまたポソぺぞタ黑匚ゼぽ九バハマ弌タソミ珱ぜべグマン
+ </d:element>
<d:element>ぽひバゼび黑んびべ九ёぺボチ珱ボバひンヲ黑珱をゼバひせあ匚ヲソタま裹ポボ欲歹チマぽタチ亜ゼゾぺタク九あ欲マ縷マゼ珱ぺ欲я欲ほ</d:element>
<d:element>lysycttndqhdmziymraxpuhbcsnamva</d:element>
<d:element>ynlpossfcjbfofcticnhgstmmslbtekrdssiimkßpipjj</d:element>
<d:element>ソクをソボゾ匚ン亜ひ</d:element>
- <d:element>ポ九ダぴヲダぁぴべたびボぼヲま九ををァボハя歹ソチ暦ひゾヲァaゾタそ黑ァёべソポ歹黑ほぺぞ珱グタゾほソ珱ミんまボ裹ぜボひゼチほ畚べマそぞぁzマせ珱ポ暦マ匚ボんマソボンミ畚あ匚ぴ</d:element>
+ <d:element>ポ九ダぴヲダぁぴべたびボぼヲま九ををァボハя歹ソチ暦ひゾヲァaゾタそ黑ァёべソポ歹黑ほぺぞ珱グタゾほソ珱ミんまボ裹ぜボひゼチほ畚べマそぞぁzマせ珱ポ暦マ匚ボんマソボンミ畚あ匚ぴ
+ </d:element>
<d:element>yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv</d:element>
<d:element>jukerqchooqmlqug</d:element>
- <d:element>sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz</d:element>
+ <d:element>sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz
+ </d:element>
</d:AlternativeNames>
</d:ContactAlias>
<d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
@@ -518,8 +572,9 @@
<d:Auditing m:null="true" />
</m:properties>
</content>
+ <m:error>
+ <m:code />
+ <m:message xml:lang="en-US">InStreamErrorGetCustomer ThrowForSpecificCustomer error</m:message>
+ </m:error>
</entry>
- <m:error>
- <m:code />
- <m:message xml:lang="en-US">InStreamErrorGetCustomer ThrowForSpecificCustomer error</m:message>
- </m:error>
\ No newline at end of file
+</feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f7a8658/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b0c4839..b3600ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
+ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.olingo</groupId>
@@ -66,7 +66,7 @@
<commons.codec.version>1.9</commons.codec.version>
<commons.io.version>2.4</commons.io.version>
<commons.lang3.version>3.3.1</commons.lang3.version>
-
+
<commons.logging.version>1.1.3</commons.logging.version>
<commons.vfs.version>2.0</commons.vfs.version>
<esigate.version>4.3</esigate.version>
@@ -78,17 +78,17 @@
<jackson.version>2.3.2</jackson.version>
<antlr.version>4.1</antlr.version>
-
- <sl4j.version>1.7.6</sl4j.version>
-
+
+ <sl4j.version>1.7.6</sl4j.version>
+
<log.directory>${project.build.directory}/log</log.directory>
-
+
<cargo.servlet.port>9080</cargo.servlet.port>
<cargo.tomcat.ajp.port>9889</cargo.tomcat.ajp.port>
<cargo.rmi.port>9805</cargo.rmi.port>
<cargo.log>${log.directory}/cargo.log</cargo.log>
<cargo.output>${log.directory}/cargo-output.log</cargo.output>
- <tomcat.version>7.0.52</tomcat.version>
+ <tomcat.version>7.0.52</tomcat.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -128,7 +128,7 @@
<artifactId>httpclient</artifactId>
<version>${hc.client.version}</version>
</dependency>
-
+
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
@@ -165,7 +165,7 @@
<artifactId>slf4j-api</artifactId>
<version>${sl4j.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
@@ -191,7 +191,7 @@
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
-
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -203,7 +203,7 @@
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
@@ -237,7 +237,7 @@
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
</plugin>
-
+
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
@@ -253,7 +253,7 @@
<log>${cargo.log}</log>
<output>${cargo.output}</output>
</container>
-
+
<configuration>
<type>standalone</type>
<properties>
@@ -261,7 +261,7 @@
<cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
<cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
- <!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</cargo.jvmargs>-->
+ <!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</cargo.jvmargs> -->
<cargo.jvmargs>-noverify -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
</properties>
<files>
@@ -295,7 +295,7 @@
</deployables>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -329,7 +329,7 @@
</plugins>
</pluginManagement>
-
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -348,6 +348,13 @@
<wtpversion>2.0</wtpversion>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
+
+ <sourceExcludes>
+ <excludes>
+ target/**
+ </excludes>
+ </sourceExcludes>
+
</configuration>
</plugin>
<plugin>
[17/51] [abbrv] git commit: [OLINGO-200] V4 (de)serialization tests
for EntitySet and Property
Posted by sk...@apache.org.
[OLINGO-200] V4 (de)serialization tests for EntitySet and Property
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/eeb5d9b4
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/eeb5d9b4
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/eeb5d9b4
Branch: refs/heads/olingo-206-validator
Commit: eeb5d9b4ab459ed6a4e574e9b50b42919a634460
Parents: dc2922c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 15:17:08 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 15:17:08 2014 +0200
----------------------------------------------------------------------
.../client/core/op/AbstractODataBinder.java | 2 +
.../olingo/client/core/v3/EntitySetTest.java | 3 +-
.../olingo/client/core/v3/EntityTest.java | 21 ++-
.../apache/olingo/client/core/v3/JSONTest.java | 10 +-
.../olingo/client/core/v3/PropertyTest.java | 11 +-
.../olingo/client/core/v4/EntitySetTest.java | 65 +++++++++
.../olingo/client/core/v4/EntityTest.java | 94 +++++++++++++
.../apache/olingo/client/core/v4/JSONTest.java | 10 +-
.../olingo/client/core/v4/PropertyTest.java | 138 ++++++++++++++++++
...ccounts_101_expand_MyPaymentInstruments.json | 94 +++++++++++++
...Accounts_101_expand_MyPaymentInstruments.xml | 129 +++++++++++++++++
...ts_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json | 16 +++
...nts_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml | 46 ++++++
.../apache/olingo/client/core/v4/Customers.json | 57 ++++++++
.../apache/olingo/client/core/v4/Customers.xml | 106 ++++++++++++++
.../client/core/v4/Employees_3_HomeAddress.json | 6 +
.../client/core/v4/Employees_3_HomeAddress.xml | 31 ++++
.../olingo/client/core/v4/PersonDetails_1.json | 22 +++
.../olingo/client/core/v4/PersonDetails_1.xml | 55 ++++++++
.../olingo/client/core/v4/Products_5.json | 30 +++-
.../client/core/v4/Products_5_CoverColors.json | 5 +
.../client/core/v4/Products_5_CoverColors.xml | 30 ++++
.../olingo/client/core/v4/VipCustomer.xml | 6 +
.../apache/olingo/commons/api/Constants.java | 12 +-
.../apache/olingo/commons/api/data/Entry.java | 14 ++
.../commons/api/domain/CommonODataEntity.java | 38 +++++
.../olingo/commons/api/domain/ODataLink.java | 8 ++
.../api/edm/constants/ODataServiceVersion.java | 12 ++
.../olingo/commons/core/data/AbstractEntry.java | 12 ++
.../commons/core/data/AtomDeserializer.java | 5 +
.../core/data/AtomPropertyDeserializer.java | 4 +-
.../core/data/JSONEntryDeserializer.java | 30 ++--
.../olingo/commons/core/data/JSONEntryImpl.java | 21 ---
.../core/data/JSONPropertyDeserializer.java | 16 +--
.../core/data/ODataJacksonDeserializer.java | 9 ++
.../domain/AbstractODataCollectionValue.java | 4 +-
.../core/domain/AbstractODataEntity.java | 140 ++++++-------------
37 files changed, 1124 insertions(+), 188 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index faed745..c41ad6b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -174,6 +174,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (entity.isMediaEntity()) {
entry.setMediaContentSource(entity.getMediaContentSource());
entry.setMediaContentType(entity.getMediaContentType());
+ entry.setMediaETag(entity.getMediaETag());
}
for (CommonODataProperty property : entity.getProperties()) {
@@ -342,6 +343,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
entity.setMediaEntity(true);
entity.setMediaContentSource(resource.getMediaContentSource());
entity.setMediaContentType(resource.getMediaContentType());
+ entity.setMediaETag(resource.getMediaETag());
}
for (Property property : resource.getProperties()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index 1f02432..0400321 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -27,6 +27,7 @@ import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.junit.Test;
@@ -39,7 +40,7 @@ public class EntitySetTest extends AbstractTest {
private void read(final ODataPubFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
- final CommonODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
getClient().getDeserializer().toFeed(input, format).getObject());
assertNotNull(entitySet);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 41da651..99b9423 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -24,12 +24,11 @@ import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -82,12 +81,12 @@ public class EntityTest extends AbstractTest {
private void readGeospatial(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-8." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
boolean found = false;
- for (CommonODataProperty property : entity.getProperties()) {
+ for (ODataProperty property : entity.getProperties()) {
if ("GeogMultiLine".equals(property.getName())) {
found = true;
assertTrue(property.hasPrimitiveValue());
@@ -96,7 +95,7 @@ public class EntityTest extends AbstractTest {
}
assertTrue(found);
- final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -114,14 +113,14 @@ public class EntityTest extends AbstractTest {
private void withActions(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("ComputerDetail_-10." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertEquals(1, entity.getOperations().size());
assertEquals("ResetComputerDetailsSpecifications", entity.getOperations().get(0).getTitle());
- final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
entity.getOperations().clear();
assertEquals(entity, written);
@@ -140,14 +139,14 @@ public class EntityTest extends AbstractTest {
private void mediaEntity(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Car_16." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertTrue(entity.isMediaEntity());
assertNotNull(entity.getMediaContentSource());
assertNotNull(entity.getMediaContentType());
- final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -164,11 +163,11 @@ public class EntityTest extends AbstractTest {
private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
- final CommonODataProperty geogCollection = entity.getProperty("GeogCollection");
+ final ODataProperty geogCollection = entity.getProperty("GeogCollection");
assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getPrimitiveValue().getTypeKind());
int count = 0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
index 522e686..64badc0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
@@ -67,8 +67,8 @@ public class JSONTest extends AtomTest {
if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) {
node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK));
}
- if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE));
}
final List<String> toRemove = new ArrayList<String>();
for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
@@ -79,10 +79,12 @@ public class JSONTest extends AtomTest {
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
|| field.getKey().endsWith(
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
- || field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX)
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))
|| field.getKey().endsWith(
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
- || field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) {
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) {
toRemove.add(field.getKey());
} else if (field.getValue().isObject()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 8676d6f..317d1ac 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -58,7 +58,7 @@ public class PropertyTest extends AbstractTest {
assertEquals("-10", value.toString());
}
- private ODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
+ private void primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId." + getSuffix(format));
final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
@@ -80,8 +80,6 @@ public class PropertyTest extends AbstractTest {
}
assertEquals(property, comparable);
-
- return property;
}
@Test
@@ -94,7 +92,7 @@ public class PropertyTest extends AbstractTest {
primitive(ODataFormat.JSON);
}
- private ODataProperty complex(final ODataFormat format) throws IOException {
+ private void complex(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_PrimaryContactInfo." + getSuffix(format));
final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
@@ -118,8 +116,6 @@ public class PropertyTest extends AbstractTest {
}
assertEquals(property, comparable);
-
- return property;
}
@Test
@@ -132,7 +128,7 @@ public class PropertyTest extends AbstractTest {
complex(ODataFormat.JSON);
}
- private ODataProperty collection(final ODataFormat format) throws IOException {
+ private void collection(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_BackupContactInfo." + getSuffix(format));
final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
@@ -156,7 +152,6 @@ public class PropertyTest extends AbstractTest {
}
assertEquals(property, comparable);
- return property;
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/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
new file mode 100644
index 0000000..6708be6
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.core.op.ResourceFactory;
+import org.junit.Test;
+
+public class EntitySetTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private void read(final ODataPubFormat format) throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(format));
+ final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ getClient().getDeserializer().toFeed(input, format).getObject());
+ assertNotNull(entitySet);
+
+ assertEquals(2, entitySet.getEntities().size());
+ assertNull(entitySet.getNext());
+
+ final CommonODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
+ getBinder().getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entitySet, written);
+ }
+
+ @Test
+ public void fromAtom() throws IOException {
+ read(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void fromJSON() throws IOException {
+ read(ODataPubFormat.JSON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index 97b6a44..e061be6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -19,6 +19,7 @@
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;
@@ -26,6 +27,7 @@ import java.io.InputStream;
import java.util.Iterator;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
@@ -79,6 +81,12 @@ public class EntityTest extends AbstractTest {
}
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 ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
@@ -130,4 +138,90 @@ public class EntityTest extends AbstractTest {
public void jsonWithEnums() {
withEnums(ODataPubFormat.JSON_FULL_METADATA);
}
+
+ private void withInlineEntitySet(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream(
+ "Accounts_101_expand_MyPaymentInstruments." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ final ODataLink instruments = entity.getNavigationLink("MyPaymentInstruments");
+ assertNotNull(instruments);
+ assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, instruments.getType());
+
+ final ODataInlineEntitySet 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 ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomWithInlineEntitySet() {
+ withInlineEntitySet(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonWithInlineEntitySet() {
+ withInlineEntitySet(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ private void mediaEntity(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream(
+ "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ assertTrue(entity.isMediaEntity());
+ assertNotNull(entity.getMediaContentSource());
+ assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
+
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomMediaEntity() {
+ mediaEntity(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonMediaEntity() {
+ mediaEntity(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ private void withStream(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ assertFalse(entity.isMediaEntity());
+
+ final ODataLink editMedia = entity.getEditMediaLink("Photo");
+ assertNotNull(editMedia);
+
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomWithStream() {
+ withStream(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonWithStream() {
+ withStream(ODataPubFormat.JSON_FULL_METADATA);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/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
index 272ab13..770f112 100644
--- 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
@@ -73,8 +73,8 @@ public class JSONTest extends AbstractTest {
if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) {
node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK));
}
- if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE));
}
final List<String> toRemove = new ArrayList<String>();
for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
@@ -85,10 +85,12 @@ public class JSONTest extends AbstractTest {
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
|| field.getKey().endsWith(
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
- || field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX)
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))
|| field.getKey().endsWith(
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
- || field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) {
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) {
toRemove.add(field.getKey());
} else if (field.getValue().isObject()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
new file mode 100644
index 0000000..022496c
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
@@ -0,0 +1,138 @@
+/*
+ * 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 java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class PropertyTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private void _enum(final ODataFormat format) {
+ final InputStream input = getClass().getResourceAsStream("Products_5_SkinColor." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasEnumValue());
+
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ // This is needed because type information gets lost with serialization
+ if (format == ODataFormat.XML) {
+ final ODataProperty comparable = getClient().getObjectFactory().newEnumProperty(property.getName(),
+ getClient().getObjectFactory().
+ newEnumValue(property.getEnumValue().getTypeName(), written.getEnumValue().getValue()));
+
+ assertEquals(property, comparable);
+ }
+ }
+
+ @Test
+ public void xmlEnum() throws IOException, EdmPrimitiveTypeException {
+ _enum(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonEnum() throws IOException, EdmPrimitiveTypeException {
+ _enum(ODataFormat.JSON);
+ }
+
+ private void complex(final ODataFormat format) throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Employees_3_HomeAddress." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasComplexValue());
+ assertEquals(3, property.getComplexValue().size());
+
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ // This is needed because type information gets lost with JSON serialization
+ final ODataComplexValue<ODataProperty> typedValue = getClient().getObjectFactory().
+ newComplexValue(property.getComplexValue().getTypeName());
+ for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+ final ODataProperty prop = itor.next();
+ typedValue.add(prop);
+ }
+ final ODataProperty comparable = getClient().getObjectFactory().
+ newComplexProperty(property.getName(), typedValue);
+
+ assertEquals(property, comparable);
+ }
+
+ @Test
+ public void xmlComplex() throws IOException {
+ complex(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonComplex() throws IOException {
+ complex(ODataFormat.JSON);
+ }
+
+ private void collection(final ODataFormat format) throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Products_5_CoverColors." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasCollectionValue());
+ assertEquals(3, property.getCollectionValue().size());
+
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ // This is needed because type information gets lost with JSON serialization
+ if (format == ODataFormat.XML) {
+ final ODataCollectionValue<ODataValue> typedValue = getClient().getObjectFactory().
+ newCollectionValue(property.getCollectionValue().getTypeName());
+ for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
+ final ODataValue value = itor.next();
+ typedValue.add(value);
+ }
+ final ODataProperty comparable = getClient().getObjectFactory().
+ newCollectionProperty(property.getName(), typedValue);
+
+ assertEquals(property, comparable);
+ }
+ }
+
+ @Test
+ public void xmlCollection() throws IOException {
+ collection(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonCollection() throws IOException {
+ collection(ODataFormat.JSON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
new file mode 100644
index 0000000..776d578
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
@@ -0,0 +1,94 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts/$entity",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Account",
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)",
+ "AccountID": 101,
+ "Country": "US",
+ "AccountInfo": {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+ "FirstName": "Alex",
+ "LastName": "Green",
+ "MiddleName": "Hood"
+ },
+ "MyPaymentInstruments@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts(101)/MyPaymentInstruments",
+ "MyPaymentInstruments@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments/$ref",
+ "MyPaymentInstruments@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments",
+ "MyPaymentInstruments": [{
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ "@odata.id": "Accounts(101)/MyPaymentInstruments(101901)",
+ "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101901)",
+ "PaymentInstrumentID": 101901,
+ "FriendlyName": "101 first PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2012-11-01T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"
+ }, {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "@odata.id": "Accounts(101)/MyPaymentInstruments(101902)",
+ "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "PaymentInstrumentID": 101902,
+ "FriendlyName": "101 frist credit PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2012-11-01T00:00:00Z",
+ "CardNumber": "6000000000000000",
+ "CVV": "234",
+ "HolderName": "Alex",
+ "Balance": 100.0,
+ "ExperationDate@odata.type": "#DateTimeOffset",
+ "ExperationDate": "2022-11-01T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
+ "CreditRecords@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
+ "CreditRecords@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
+ }, {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "@odata.id": "Accounts(101)/MyPaymentInstruments(101903)",
+ "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "PaymentInstrumentID": 101903,
+ "FriendlyName": "101 second credit PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2012-11-01T00:00:00Z",
+ "CardNumber": "8000000000000000",
+ "CVV": "012",
+ "HolderName": "James",
+ "Balance": 300.0,
+ "ExperationDate@odata.type": "#DateTimeOffset",
+ "ExperationDate": "2022-10-02T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
+ "CreditRecords@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
+ "CreditRecords@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
+ }],
+ "MyGiftCard@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard/$ref",
+ "MyGiftCard@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard",
+ "ActiveSubscriptions@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions/$ref",
+ "ActiveSubscriptions@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions",
+ "AvailableSubscriptionTemplatess@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess/$ref",
+ "AvailableSubscriptionTemplatess@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess",
+ "#Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
new file mode 100644
index 0000000..75ec28d
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<entry xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts/$entity">
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Account" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/MyGiftCard" type="application/atom+xml;type=entry" title="MyGiftCard" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/MyPaymentInstruments" type="application/atom+xml;type=feed" title="MyPaymentInstruments" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments">
+ <m:inline>
+ <feed>
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/MyPaymentInstruments</id>
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+ <id />
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">101901</d:PaymentInstrumentID>
+ <d:FriendlyName>101 first PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="potato" />
+ <id />
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">101902</d:PaymentInstrumentID>
+ <d:FriendlyName>101 frist credit PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+ <d:CardNumber>6000000000000000</d:CardNumber>
+ <d:CVV>234</d:CVV>
+ <d:HolderName>Alex</d:HolderName>
+ <d:Balance m:type="Double">100</d:Balance>
+ <d:ExperationDate m:type="DateTimeOffset">2022-11-01T00:00:00Z</d:ExperationDate>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="potato" />
+ <id />
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">101903</d:PaymentInstrumentID>
+ <d:FriendlyName>101 second credit PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+ <d:CardNumber>8000000000000000</d:CardNumber>
+ <d:CVV>012</d:CVV>
+ <d:HolderName>James</d:HolderName>
+ <d:Balance m:type="Double">300</d:Balance>
+ <d:ExperationDate m:type="DateTimeOffset">2022-10-02T00:00:00Z</d:ExperationDate>
+ </m:properties>
+ </content>
+ </entry>
+ </feed>
+ </m:inline>
+ </link>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/ActiveSubscriptions" type="application/atom+xml;type=feed" title="ActiveSubscriptions" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/AvailableSubscriptionTemplatess" type="application/atom+xml;type=feed" title="AvailableSubscriptionTemplatess" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess" />
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:AccountID m:type="Int32">101</d:AccountID>
+ <d:Country>US</d:Country>
+ <d:AccountInfo m:type="#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo">
+ <d:FirstName>Alex</d:FirstName>
+ <d:LastName>Green</d:LastName>
+ <d:MiddleName>Hood</d:MiddleName>
+ </d:AccountInfo>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
new file mode 100644
index 0000000..eceecbb
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
@@ -0,0 +1,16 @@
+{
+ "@odata.context": "http://services.odata.org/V4/OData/OData.svc/$metadata#Advertisements/$entity",
+ "@odata.type": "#ODataDemo.Advertisement",
+ "@odata.id": "http://services.odata.org/V4/OData/OData.svc/Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)",
+ "@odata.editLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)",
+ "@odata.mediaEditLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value",
+ "@odata.mediaContentType": "*/*",
+ "@odata.mediaEtag": "\"8zOOKKvgOtptr4gt8IrnapX3jds=\"",
+ "ID@odata.type": "#Guid",
+ "ID": "f89dee73-af9f-4cd4-b330-db93c25ff3c7",
+ "Name": "Old School Lemonade Store, Retro Style",
+ "AirDate@odata.type": "#DateTimeOffset",
+ "AirDate": "2012-11-07T00:00:00Z",
+ "FeaturedProduct@odata.associationLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct/$ref",
+ "FeaturedProduct@odata.navigationLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
new file mode 100644
index 0000000..068cb53
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<entry xml:base="http://services.odata.org/V4/OData/OData.svc/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://services.odata.org/V4/OData/OData.svc/$metadata#Advertisements/$entity">
+ <id>http://services.odata.org/V4/OData/OData.svc/Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)</id>
+ <category term="#ODataDemo.Advertisement" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" title="Advertisement" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/FeaturedProduct" type="application/xml" title="FeaturedProduct" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct/$ref" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/FeaturedProduct" type="application/atom+xml;type=entry" title="FeaturedProduct" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct" />
+ <title />
+ <updated>2014-03-31T10:24:52Z</updated>
+ <author>
+ <name />
+ </author>
+ <link rel="edit-media" title="Advertisement" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value" m:etag=""8zOOKKvgOtptr4gt8IrnapX3jds="" />
+ <content type="*/*" src="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value" />
+ <m:properties>
+ <d:ID m:type="Guid">f89dee73-af9f-4cd4-b330-db93c25ff3c7</d:ID>
+ <d:Name>Old School Lemonade Store, Retro Style</d:Name>
+ <d:AirDate m:type="DateTimeOffset">2012-11-07T00:00:00Z</d:AirDate>
+ </m:properties>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
new file mode 100644
index 0000000..c8e2cdf
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
@@ -0,0 +1,57 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers",
+ "odata.count": 2,
+ "value": [{
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
+ "PersonID": 1,
+ "FirstName": "Bob",
+ "LastName": "Cat",
+ "MiddleName": null,
+ "HomeAddress": {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress",
+ "Street": "1 Microsoft Way",
+ "City": "London",
+ "PostalCode": "98052",
+ "FamilyName": "Cats"
+ },
+ "Home": {
+ "type": "Point",
+ "coordinates": [23.1, 32.1],
+ "crs": {
+ "type": "name",
+ "properties": {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers": ["111-111-1111"],
+ "Emails": ["abc@abc.com"],
+ "City": "London",
+ "Birthday": "1957-04-03T00:00:00Z",
+ "TimeBetweenLastTwoOrders": "PT0.0000001S"
+ }, {
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)",
+ "PersonID": 2,
+ "FirstName": "Jill",
+ "LastName": "Jones",
+ "MiddleName": null,
+ "HomeAddress": null,
+ "Home": {
+ "type": "Point",
+ "coordinates": [161.8, 15.0],
+ "crs": {
+ "type": "name",
+ "properties": {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers": [],
+ "Emails": [],
+ "City": "Sydney",
+ "Birthday": "1983-01-15T00:00:00Z",
+ "TimeBetweenLastTwoOrders": "PT0.0000002S"
+ }]
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
new file mode 100644
index 0000000..9b3d870
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<feed xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers">
+ <m:count>2</m:count>
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers</id>
+ <title />
+ <updated>2014-03-31T09:35:14Z</updated>
+ <entry>
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company" />
+ <title />
+ <updated>2014-03-31T09:35:14Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">1</d:PersonID>
+ <d:FirstName>Bob</d:FirstName>
+ <d:LastName>Cat</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress">
+ <d:Street>1 Microsoft Way</d:Street>
+ <d:City>London</d:City>
+ <d:PostalCode>98052</d:PostalCode>
+ <d:FamilyName>Cats</d:FamilyName>
+ </d:HomeAddress>
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>32.1 23.1</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)">
+ <m:element>111-111-1111</m:element>
+ </d:Numbers>
+ <d:Emails m:type="#Collection(String)">
+ <m:element>abc@abc.com</m:element>
+ </d:Emails>
+ <d:City>London</d:City>
+ <d:Birthday m:type="DateTimeOffset">1957-04-03T00:00:00Z</d:Birthday>
+ <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000001S</d:TimeBetweenLastTwoOrders>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Company" />
+ <title />
+ <updated>2014-03-31T09:35:14Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">2</d:PersonID>
+ <d:FirstName>Jill</d:FirstName>
+ <d:LastName>Jones</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:null="true" />
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>15 161.8</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)" />
+ <d:Emails m:type="#Collection(String)" />
+ <d:City>Sydney</d:City>
+ <d:Birthday m:type="DateTimeOffset">1983-01-15T00:00:00Z</d:Birthday>
+ <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
+ </m:properties>
+ </content>
+ </entry>
+</feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
new file mode 100644
index 0000000..8748df3
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
@@ -0,0 +1,6 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Employees(3)/HomeAddress",
+ "Street": "1 Microsoft Way",
+ "City": "Sydney",
+ "PostalCode": "98052"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
new file mode 100644
index 0000000..5029af5
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<m:value xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Employees(3)/HomeAddress"
+ m:type="#Microsoft.Test.OData.Services.ODataWCFService.Address"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
+ <d:Street>1 Microsoft Way</d:Street>
+ <d:City>Sydney</d:City>
+ <d:PostalCode>98052</d:PostalCode>
+</m:value>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
new file mode 100644
index 0000000..c8b62d3
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
@@ -0,0 +1,22 @@
+{
+ "@odata.context": "http://services.odata.org/V4/OData/OData.svc/$metadata#PersonDetails/$entity",
+ "@odata.type": "#ODataDemo.PersonDetail",
+ "@odata.id": "http://services.odata.org/V4/OData/OData.svc/PersonDetails(1)",
+ "@odata.editLink": "PersonDetails(1)",
+ "PersonID": 1,
+ "Age@odata.type": "#Byte",
+ "Age": 24,
+ "Gender": true,
+ "Phone": "(208) 555-8097",
+ "Address": {
+ "@odata.type": "#ODataDemo.Address",
+ "Street": "187 Suffolk Ln.",
+ "City": "Boise",
+ "State": "ID",
+ "ZipCode": "83720",
+ "Country": "USA"
+ },
+ "Photo@odata.mediaEditLink": "PersonDetails(1)/Photo",
+ "Person@odata.associationLink": "PersonDetails(1)/Person/$ref",
+ "Person@odata.navigationLink": "PersonDetails(1)/Person"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
new file mode 100644
index 0000000..e7fce12
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<entry xml:base="http://services.odata.org/V4/OData/OData.svc/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://services.odata.org/V4/OData/OData.svc/$metadata#PersonDetails/$entity">
+ <id>http://services.odata.org/V4/OData/OData.svc/PersonDetails(1)</id>
+ <category term="#ODataDemo.PersonDetail" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" title="PersonDetail" href="PersonDetails(1)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Person" type="application/xml" title="Person" href="PersonDetails(1)/Person/$ref" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Person" type="application/atom+xml;type=entry" title="Person" href="PersonDetails(1)/Person" />
+ <title />
+ <updated>2014-03-31T10:28:24Z</updated>
+ <author>
+ <name />
+ </author>
+ <link rel="http://docs.oasis-open.org/odata/ns/edit-media/Photo" title="Photo" href="PersonDetails(1)/Photo" />
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">1</d:PersonID>
+ <d:Age m:type="Byte">24</d:Age>
+ <d:Gender m:type="Boolean">true</d:Gender>
+ <d:Phone>(208) 555-8097</d:Phone>
+ <d:Address m:type="#ODataDemo.Address">
+ <d:Street>187 Suffolk Ln.</d:Street>
+ <d:City>Boise</d:City>
+ <d:State>ID</d:State>
+ <d:ZipCode>83720</d:ZipCode>
+ <d:Country>USA</d:Country>
+ </d:Address>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
index 22c8473..0545d78 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
@@ -1 +1,29 @@
-{"@odata.context":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity","@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.Product","@odata.id":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)","@odata.editLink":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)","ProductID":5,"Name":"Cheetos","QuantityPerUnit":"100g Bag","UnitPrice@odata.type":"#Single","UnitPrice":3.24,"QuantityInStock":100,"Discontinued":true,"UserAccess@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel","UserAccess":"None","SkinColor@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.Color","SkinColor":"Red","CoverColors@odata.type":"#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)","CoverColors":["Green","Blue","Blue"],"Details@odata.associationLink":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details/$ref","Details@odata.navigationLink":
"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details","#Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight":{"title":"Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight","target":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"},"#Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails":{"title":"Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails","target":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"}}
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Product",
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)",
+ "ProductID": 5,
+ "Name": "Cheetos",
+ "QuantityPerUnit": "100g Bag",
+ "UnitPrice@odata.type": "#Single",
+ "UnitPrice": 3.24,
+ "QuantityInStock": 100,
+ "Discontinued": true,
+ "UserAccess@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
+ "UserAccess": "None",
+ "SkinColor@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Color",
+ "SkinColor": "Red",
+ "CoverColors@odata.type": "#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)",
+ "CoverColors": ["Green", "Blue", "Blue"],
+ "Details@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details/$ref",
+ "Details@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details",
+ "#Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
new file mode 100644
index 0000000..96bf22a
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
@@ -0,0 +1,5 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/CoverColors",
+ "@odata.type": "#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)",
+ "value": ["Green", "Blue", "Blue"]
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
new file mode 100644
index 0000000..0dab08c
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<m:value xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/CoverColors" m:type="#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
+ <m:element>Green</m:element>
+ <m:element>Blue</m:element>
+ <m:element>Blue</m:element>
+</m:value>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
index 001c1a9..d233ce9 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
@@ -37,6 +37,12 @@
<author>
<name />
</author>
+ <m:action metadata="#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ target="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ title="Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"/>
+ <m:action metadata="#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ target="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ title="Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"/>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">1</d:PersonID>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index 0a8bafb..f41c30c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -57,6 +57,8 @@ public interface Constants {
public static final String SELF_LINK_REL = "self";
+ public static final String EDITMEDIA_LINK_REL = "edit-media";
+
public static final String NEXT_LINK_REL = "next";
// XML elements and attributes
@@ -143,16 +145,6 @@ public interface Constants {
public final static String JSON_METADATA_ETAG = "@odata.metadataEtag";
- public final static String JSON_ETAG = "odata.etag";
-
- public final static String JSON_MEDIA_ETAG = "odata.mediaETag";
-
- public final static String JSON_MEDIA_ETAG_SUFFIX = "@" + JSON_MEDIA_ETAG;
-
- public final static String JSON_MEDIA_CONTENT_TYPE = "odata.mediaContentType";
-
- public final static String JSON_MEDIA_CONTENT_TYPE_SUFFIX = "@" + JSON_MEDIA_CONTENT_TYPE;
-
public final static String JSON_BIND_LINK_SUFFIX = "@odata.bind";
public final static String JSON_NULL = "odata.null";
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
index c064216..5e24e8a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
@@ -166,6 +166,20 @@ public interface Entry {
void setMediaContentType(String mediaContentType);
/**
+ * ETag of the binary stream represented by this media entity or named stream property.
+ *
+ * @return media ETag value
+ */
+ String getMediaETag();
+
+ /**
+ * Set media ETag.
+ *
+ * @param eTag media ETag value
+ */
+ void setMediaETag(String eTag);
+
+ /**
* Checks if the current entry is a media entry.
*
* @return 'TRUE' if is a media entry; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
index f4b0d2f..6d832c8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
@@ -91,6 +91,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
boolean removeLink(ODataLink link);
/**
+ * Gets association link with given name, if available, otherwise <tt>null</tt>.
+ *
+ * @param name candidate link name
+ * @return association link with given name, if available, otherwise <tt>null</tt>
+ */
+ ODataLink getAssociationLink(String name);
+
+ /**
* Returns all entity association links.
*
* @return OData entity links.
@@ -98,6 +106,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
List<ODataLink> getAssociationLinks();
/**
+ * Gets navigation link with given name, if available, otherwise <tt>null</tt>.
+ *
+ * @param name candidate link name
+ * @return navigation link with given name, if available, otherwise <tt>null</tt>
+ */
+ ODataLink getNavigationLink(String name);
+
+ /**
* Returns all entity navigation links (including inline entities / feeds).
*
* @return OData entity links.
@@ -105,6 +121,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
List<ODataLink> getNavigationLinks();
/**
+ * Gets media-edit link with given name, if available, otherwise <tt>null</tt>.
+ *
+ * @param name candidate link name
+ * @return media-edit link with given name, if available, otherwise <tt>null</tt>
+ */
+ ODataLink getEditMediaLink(String name);
+
+ /**
* Returns all entity media edit links.
*
* @return OData entity links.
@@ -174,4 +198,18 @@ public interface CommonODataEntity extends ODataInvokeResult {
*/
void setMediaContentSource(String mediaContentSource);
+ /**
+ * ETag of the binary stream represented by this media entity or named stream property.
+ *
+ * @return media ETag value
+ */
+ String getMediaETag();
+
+ /**
+ * Set media ETag.
+ *
+ * @param eTag media ETag value
+ */
+ void setMediaETag(String eTag);
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
index 2735f99..d463511 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
@@ -168,6 +168,14 @@ public class ODataLink extends ODataItem {
return type;
}
+ public ODataInlineEntity asInlineEntity() {
+ return (this instanceof ODataInlineEntity) ? (ODataInlineEntity) this : null;
+ }
+
+ public ODataInlineEntitySet asInlineEntitySet() {
+ return (this instanceof ODataInlineEntitySet) ? (ODataInlineEntitySet) this : null;
+ }
+
/**
* Gets link rel.
*
[41/51] [abbrv] git commit: [OLINGO-206] Merge remote-tracking branch
'origin/master' into olingo-206-val
Posted by sk...@apache.org.
[OLINGO-206] Merge remote-tracking branch 'origin/master' into olingo-206-val
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/49e1069f
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/49e1069f
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/49e1069f
Branch: refs/heads/olingo-206-validator
Commit: 49e1069ff8175ff7da319181da5f2a075e9840f6
Parents: 929fb65 242f782
Author: Stephan Klevenz <st...@sap.com>
Authored: Wed Apr 2 12:28:36 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Wed Apr 2 12:28:36 2014 +0200
----------------------------------------------------------------------
fit/pom.xml | 4 ++--
lib/client-api/pom.xml | 6 +++---
lib/client-core/pom.xml | 10 +++++-----
lib/commons-api/pom.xml | 4 ++--
lib/commons-core/pom.xml | 6 +++---
lib/pom.xml | 4 ++--
lib/ref/pom.xml | 8 ++++----
lib/server-api/pom.xml | 6 +++---
lib/server-core/pom.xml | 8 ++++----
pom.xml | 4 ++--
10 files changed, 30 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
[47/51] [abbrv] git commit: [OLINGO-209] Methods added to Edm
interfaces, with default implementations compliant to OData 4.0 specs
Posted by sk...@apache.org.
[OLINGO-209] Methods added to Edm interfaces, with default implementations compliant to OData 4.0 specs
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/aeb66aa8
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/aeb66aa8
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/aeb66aa8
Branch: refs/heads/olingo-206-validator
Commit: aeb66aa82a994e1c2046786db72b640fa671ac44
Parents: 809519f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Apr 3 10:45:46 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Apr 3 10:45:46 2014 +0200
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 14 +---
.../java/org/apache/olingo/fit/V3Services.java | 31 +++++++++
fit/src/main/resources/v3/openTypeMetadata.xml | 67 ++++++++++++++++++++
.../client/core/edm/EdmEntityContainerImpl.java | 13 ++--
.../client/core/edm/EdmEntityTypeImpl.java | 8 +++
.../olingo/client/core/edm/EdmSchemaImpl.java | 47 +++++++++++++-
.../apache/olingo/client/core/uri/URIUtils.java | 7 +-
.../client/core/it/v3/AbstractTestITCase.java | 6 +-
.../client/core/it/v3/OpenTypeTestITCase.java | 17 ++---
.../commons/api/edm/EdmEntityContainer.java | 23 +++++--
.../olingo/commons/api/edm/EdmEntityType.java | 11 +++-
.../olingo/commons/api/edm/EdmSchema.java | 36 ++++++++---
.../core/edm/AbstractEdmEntityContainer.java | 16 ++++-
.../commons/core/edm/AbstractEdmEntityType.java | 7 +-
.../commons/core/edm/AbstractEdmSchemaImpl.java | 26 ++++++++
.../core/edm/provider/EdmEntityTypeImpl.java | 11 +++-
16 files changed, 284 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
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 3d80514..fd64d3d 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -124,18 +124,6 @@ public abstract class AbstractServices {
return getMetadata(Constants.get(getVersion(), ConstantKey.METADATA));
}
- /**
- * Provide sample lartge metadata.
- *
- * @return metadata.
- */
- @GET
- @Path("/large/$metadata")
- @Produces("application/xml")
- public Response getLargeMetadata() {
- return getMetadata("large" + StringUtils.capitalize(Constants.get(getVersion(), ConstantKey.METADATA)));
- }
-
protected Response getMetadata(final String filename) {
try {
return xml.createResponse(FSManager.instance(getVersion()).readFile(filename, Accept.XML), null, Accept.XML);
@@ -176,7 +164,7 @@ public abstract class AbstractServices {
return utils.getValue().createResponse(
FSManager.instance(getVersion()).readFile(Constants.get(getVersion(), ConstantKey.REF)
- + File.separatorChar + filename, utils.getKey()),
+ + File.separatorChar + filename, utils.getKey()),
null,
utils.getKey());
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/fit/src/main/java/org/apache/olingo/fit/V3Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3Services.java b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
index 11eaa81..916ca82 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
@@ -18,10 +18,16 @@
*/
package org.apache.olingo.fit;
+import javax.ws.rs.GET;
import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
@Path("/V30/Static.svc")
@InInterceptors(classes = XHTTPMethodInterceptor.class)
@@ -35,4 +41,29 @@ public class V3Services extends AbstractServices {
protected ODataVersion getVersion() {
return ODataVersion.v3;
}
+
+ /**
+ * Provide sample large metadata.
+ *
+ * @return metadata.
+ */
+ @GET
+ @Path("/large/$metadata")
+ @Produces("application/xml")
+ public Response getLargeMetadata() {
+ return getMetadata("large" + StringUtils.capitalize(Constants.get(getVersion(), ConstantKey.METADATA)));
+ }
+
+ /**
+ * Provide sample large metadata.
+ *
+ * @return metadata.
+ */
+ @GET
+ @Path("/openType/$metadata")
+ @Produces("application/xml")
+ public Response getOpenTypeMetadata() {
+ return getMetadata("openType" + StringUtils.capitalize(Constants.get(getVersion(), ConstantKey.METADATA)));
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/fit/src/main/resources/v3/openTypeMetadata.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/openTypeMetadata.xml b/fit/src/main/resources/v3/openTypeMetadata.xml
new file mode 100644
index 0000000..42a7dea
--- /dev/null
+++ b/fit/src/main/resources/v3/openTypeMetadata.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
+ <edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
+ <Schema Namespace="Microsoft.Test.OData.Services.OpenTypesService" xmlns="http://schemas.microsoft.com/ado/2008/01/edm">
+ <ComplexType Name="ContactDetails">
+ <Property Name="FirstContacted" Type="Edm.Binary"/>
+ <Property Name="LastContacted" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <Property Name="Contacted" Type="Edm.DateTime" Nullable="false"/>
+ <Property Name="GUID" Type="Edm.Guid" Nullable="false"/>
+ <Property Name="PreferedContactTime" Type="Edm.Time" Nullable="false"/>
+ <Property Name="Byte" Type="Edm.Byte" Nullable="false"/>
+ <Property Name="SignedByte" Type="Edm.SByte" Nullable="false"/>
+ <Property Name="Double" Type="Edm.Double" Nullable="false"/>
+ <Property Name="Single" Type="Edm.Single" Nullable="false"/>
+ <Property Name="Short" Type="Edm.Int16" Nullable="false"/>
+ <Property Name="Int" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Long" Type="Edm.Int64" Nullable="false"/>
+ </ComplexType>
+ <EntityType Name="Row" OpenType="true">
+ <Key>
+ <PropertyRef Name="Id"/>
+ </Key>
+ <Property Name="Id" Type="Edm.Guid" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="IndexedRow" BaseType="Microsoft.Test.OData.Services.OpenTypesService.Row" OpenType="true"/>
+ <EntityType Name="RowIndex" OpenType="true">
+ <Key>
+ <PropertyRef Name="Id"/>
+ </Key>
+ <Property Name="Id" Type="Edm.Int32" Nullable="false"/>
+ <NavigationProperty Name="Rows" Relationship="Microsoft.Test.OData.Services.OpenTypesService.RowIndex_Rows" ToRole="Rows" FromRole="RowIndex"/>
+ </EntityType>
+ <Association Name="RowIndex_Rows">
+ <End Type="Microsoft.Test.OData.Services.OpenTypesService.RowIndex" Role="RowIndex" Multiplicity="*"/>
+ <End Type="Microsoft.Test.OData.Services.OpenTypesService.IndexedRow" Role="Rows" Multiplicity="*"/>
+ </Association>
+ <EntityContainer Name="DefaultContainer" m:IsDefaultEntityContainer="true">
+ <EntitySet Name="Row" EntityType="Microsoft.Test.OData.Services.OpenTypesService.Row"/>
+ <EntitySet Name="RowIndex" EntityType="Microsoft.Test.OData.Services.OpenTypesService.RowIndex"/>
+ <AssociationSet Name="Index_Rows" Association="Microsoft.Test.OData.Services.OpenTypesService.RowIndex_Rows">
+ <End Role="RowIndex" EntitySet="RowIndex"/>
+ <End Role="Rows" EntitySet="Row"/>
+ </AssociationSet>
+ </EntityContainer>
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
index e73d3be..fba22a8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@ -50,17 +50,18 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
final EntityContainer xmlEntityContainer, final List<? extends Schema> xmlSchemas) {
- super(edm, entityContainerName, getFullQualifiedName(xmlEntityContainer.getExtends()));
+ super(edm, entityContainerName, xmlEntityContainer.getExtends() == null
+ ? null : new FullQualifiedName(xmlEntityContainer.getExtends()));
this.xmlEntityContainer = xmlEntityContainer;
this.xmlSchemas = xmlSchemas;
}
- private static FullQualifiedName getFullQualifiedName(String parent) {
- if (parent != null) {
- return new FullQualifiedName(parent);
- }
- return null;
+ @Override
+ public boolean isDefault() {
+ return xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer
+ ? true
+ : xmlEntityContainer.isDefaultEntityContainer();
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
index c5637e7..0f9d0e6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
@@ -61,11 +61,14 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
return instance;
}
+ private final EntityType entityType;
+
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
final EntityType entityType) {
super(edm, fqn, baseTypeName, entityType.isHasStream());
this.helper = new EdmStructuredTypeHelperImpl(edm, entityType);
+ this.entityType = entityType;
}
@Override
@@ -78,4 +81,9 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
return helper.getNavigationProperties();
}
+ @Override
+ public boolean isOpenType() {
+ return entityType.isOpenType();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
index 2989a86..7d8e1ae 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
@@ -19,7 +19,9 @@
package org.apache.olingo.client.core.edm;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.olingo.client.api.edm.xml.ComplexType;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
@@ -53,6 +55,10 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
private final Schema schema;
+ private Map<FullQualifiedName, EdmEntityContainer> entityContainerByName;
+
+ private List<EdmEntityContainer> entityContainers;
+
public EdmSchemaImpl(final ODataServiceVersion version, final Edm edm,
final List<? extends Schema> xmlSchemas, final Schema schema) {
@@ -65,8 +71,36 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
}
@Override
- protected EdmEntityContainer createEntityContainer() {
- final EntityContainer defaultContainer = schema.getDefaultEntityContainer();
+ public List<EdmEntityContainer> getEntityContainers() {
+ if (entityContainers == null) {
+ if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
+ entityContainers = super.getEntityContainers();
+ entityContainerByName = new HashMap<FullQualifiedName, EdmEntityContainer>();
+ entityContainerByName.put(
+ new FullQualifiedName(getEntityContainer().getNamespace(), getEntityContainer().getName()),
+ getEntityContainer());
+ } else {
+ entityContainers = new ArrayList<EdmEntityContainer>(schema.getEntityContainers().size());
+ for (EntityContainer entityContainer : schema.getEntityContainers()) {
+ final EdmEntityContainer edmContainer = createEntityContainer(entityContainer.getName());
+ final FullQualifiedName fqn = new FullQualifiedName(edmContainer.getNamespace(), edmContainer.getName());
+
+ entityContainers.add(edmContainer);
+ entityContainerByName.put(fqn, edmContainer);
+ }
+ }
+ }
+
+ return entityContainers;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
+ return entityContainerByName.get(name);
+ }
+
+ private EdmEntityContainer createEntityContainer(final String name) {
+ final EntityContainer defaultContainer = schema.getEntityContainer(name);
if (defaultContainer != null) {
final FullQualifiedName entityContainerName =
new FullQualifiedName(schema.getNamespace(), defaultContainer.getName());
@@ -76,6 +110,15 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
}
@Override
+ protected EdmEntityContainer createEntityContainer() {
+ final EntityContainer defaultContainer = schema.getDefaultEntityContainer();
+ if (defaultContainer != null) {
+ return createEntityContainer(defaultContainer.getName());
+ }
+ return null;
+ }
+
+ @Override
protected List<EdmTypeDefinition> createTypeDefinitions() {
final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>();
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 94eccf5..b31b81c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -150,10 +150,9 @@ public final class URIUtils {
final EdmEntityContainer entityContainer, final EdmFunctionImport functionImport) {
final StringBuilder result = new StringBuilder();
- // TODO: https://issues.apache.org/jira/browse/OLINGO-209
- // if (!entityContainer.isDefaultEntityContainer()) {
- // result.append(entityContainer.getName()).append('.');
- // }
+ if (!entityContainer.isDefault()) {
+ result.append(entityContainer.getName()).append('.');
+ }
result.append(functionImport.getName());
return result.toString();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
index 325f2dd..f73c7cb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
@@ -83,13 +83,12 @@ public abstract class AbstractTestITCase {
protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product";
- protected static final String servicesODataServiceRootURL =
- "http://services.odata.org/V3/(S(csquyjnoaywmz5xcdbfhlc1p))/OData/OData.svc/";
-
protected static ODataClient client;
protected static String testStaticServiceRootURL;
+ protected static String testOpenTypeServiceRootURL;
+
protected static String testLargeModelServiceRootURL;
protected static String testAuthServiceRootURL;
@@ -97,6 +96,7 @@ public abstract class AbstractTestITCase {
@BeforeClass
public static void setUpODataServiceRoot() throws IOException {
testStaticServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc";
+ testOpenTypeServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc/openType";
testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc/large";
testAuthServiceRootURL = "http://localhost:9080/DefaultService.svc";
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index 3a90d70..d5e24ef 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -18,6 +18,10 @@
*/
package org.apache.olingo.client.core.it.v3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -33,6 +37,7 @@ import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
@@ -42,9 +47,6 @@ import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -53,14 +55,13 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
@Test
public void checkOpenTypeEntityTypesExist() {
final Edm metadata = client.getRetrieveRequestFactory().
- getMetadataRequest(testStaticServiceRootURL).execute().getBody();
+ getMetadataRequest(testOpenTypeServiceRootURL).execute().getBody();
final EdmSchema schema = metadata.getSchemas().get(0);
- // TODO: https://issues.apache.org/jira/browse/OLINGO-209
-// assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "Row")).isOpenType());
-// assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "IndexedRow")).isOpenType());
-// assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType());
+ assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "Row")).isOpenType());
+ assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "IndexedRow")).isOpenType());
+ assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType());
}
private ODataEntity readRow(final ODataPubFormat format, final String uuid) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
index 84dfea4..c0e1815 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
@@ -22,7 +22,7 @@ import java.util.List;
/**
* A CSDL EntityContainer element.
- *
+ *
* <br/>
* EdmEntityContainer hold the information of EntitySets, Singletons, ActionImports and FunctionImports contained
*/
@@ -34,8 +34,17 @@ public interface EdmEntityContainer extends EdmNamed {
String getNamespace();
/**
+ * Returns whether this container is the default container in the current schema.
+ * <br/>
+ * According to CSDL specifications, this method will always return <tt>true</tt> for OData 4.0.
+ *
+ * @return whether this container is the default container in the current schema, always <tt>true</tt> for OData 4.0
+ */
+ boolean isDefault();
+
+ /**
* Get contained Singleton by name.
- *
+ *
* @param name
* @return {@link EdmSingleton}
*/
@@ -43,7 +52,7 @@ public interface EdmEntityContainer extends EdmNamed {
/**
* Get contained EntitySet by name.
- *
+ *
* @param name
* @return {@link EdmEntitySet}
*/
@@ -51,7 +60,7 @@ public interface EdmEntityContainer extends EdmNamed {
/**
* Get contained ActionImport by name.
- *
+ *
* @param name
* @return {@link EdmActionImport}
*/
@@ -59,7 +68,7 @@ public interface EdmEntityContainer extends EdmNamed {
/**
* Get contained FunctionImport by name.
- *
+ *
* @param name
* @return {@link EdmFunctionImport}
*/
@@ -67,24 +76,28 @@ public interface EdmEntityContainer extends EdmNamed {
/**
* This method <b>DOES NOT</b> support lazy loading
+ *
* @return returns all entity sets for this container.
*/
List<EdmEntitySet> getEntitySets();
/**
* This method <b>DOES NOT</b> support lazy loading
+ *
* @return returns all function imports for this container.
*/
List<EdmFunctionImport> getFunctionImports();
/**
* This method <b>DOES NOT</b> support lazy loading
+ *
* @return returns all singletons for this container.
*/
List<EdmSingleton> getSingletons();
/**
* This method <b>DOES NOT</b> support lazy loading
+ *
* @return returns all action imports for this container.
*/
List<EdmActionImport> getActionImports();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
index 362215d..fe698c4 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
@@ -28,14 +28,14 @@ public interface EdmEntityType extends EdmStructuredType {
/**
* Gets all key predicate names. In case an alias is defined for a key predicate this will be returned.
*
- * @return collection of key property names of type List<String>
+ * @return collection of key property names of type List<String>
*/
List<String> getKeyPredicateNames();
/**
* Get all key properties references as list of {@link EdmKeyPropertyRef}.
*
- * @return collection of key properties of type List<EdmKeyPropertyRef>
+ * @return collection of key properties of type List<EdmKeyPropertyRef>
*/
List<EdmKeyPropertyRef> getKeyPropertyRefs();
@@ -54,6 +54,13 @@ public interface EdmEntityType extends EdmStructuredType {
*/
boolean hasStream();
+ /**
+ * Indicates if the entity type is an open type.
+ *
+ * @return <code>true</code> if the entity type is open
+ */
+ boolean isOpenType();
+
/*
* (non-Javadoc)
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java
index d5c8a2d..993691c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java
@@ -24,47 +24,65 @@ import java.util.List;
* A csdl schema element
*/
public interface EdmSchema {
-
+
/**
* @return the namespace for this schema
*/
String getNamespace();
-
+
/**
* @return the alias for this schema. May be null.
*/
String getAlias();
-
+
/**
* @return all enum types for this schema
*/
List<EdmEnumType> getEnumTypes();
-
+
/**
* @return all entity types for this schema
*/
List<EdmEntityType> getEntityTypes();
-
+
/**
* @return all complex types for this schema
*/
List<EdmComplexType> getComplexTypes();
-
+
/**
* @return all actions for this schema
*/
List<EdmAction> getActions();
-
+
/**
* @return all functions for this schema
*/
List<EdmFunction> getFunctions();
-
+
/**
* @return the entity container for this schema. May be null.
*/
EdmEntityContainer getEntityContainer();
+ /**
+ * Returns the list of entity containers for this schema.
+ * <br/>
+ * According to CSDL specifications, this method will always return a singleton list for OData 4.0, containing the
+ * same container as returned by {@link #getEntityContainer()}.
+ *
+ * @return the list of entity containers for this schema; singleton list for OData 4.0
+ */
+ List<EdmEntityContainer> getEntityContainers();
+
+ /**
+ * Returns the entity container for the given name, or null if not found.
+ *
+ * @param name entity container full qualified name
+ * @return the entity container for the given name, or null if not found
+ */
+ EdmEntityContainer getEntityContainer(FullQualifiedName name);
+
List<EdmTypeDefinition> getTypeDefinitions();
-
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
index 1f77188..815a00f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
@@ -34,24 +34,38 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements EdmEntityContainer {
protected final FullQualifiedName entityContainerName;
+
protected final Map<String, EdmSingleton> singletons = new HashMap<String, EdmSingleton>();
+
private boolean allSingletonsLoaded = false;
+
protected final Map<String, EdmEntitySet> entitySets = new HashMap<String, EdmEntitySet>();
+
private boolean allEntitySetsLoaded = false;
+
protected final Map<String, EdmActionImport> actionImports = new HashMap<String, EdmActionImport>();
+
private final FullQualifiedName parentContainerName;
+
private boolean allActionImportsLoaded = false;
+
protected final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>();
+
private boolean allFunctionImportsLoaded = false;
public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName,
- final FullQualifiedName parentContainerName) {
+ final FullQualifiedName parentContainerName) {
super(edm, entityContainerName.getName());
this.entityContainerName = entityContainerName;
this.parentContainerName = parentContainerName;
}
@Override
+ public boolean isDefault() {
+ return true;
+ }
+
+ @Override
public String getNamespace() {
return entityContainerName.getNamespace();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
index 60af07a..3dcab9b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
@@ -34,9 +34,13 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType implements EdmEntityType {
private final boolean hasStream;
+
protected EdmEntityType entityBaseType;
+
private final List<String> keyPredicateNames = new ArrayList<String>();
+
private final Map<String, EdmKeyPropertyRef> keyPropertyRefs = new LinkedHashMap<String, EdmKeyPropertyRef>();
+
private List<EdmKeyPropertyRef> keyPropertyRefsList;
protected AbstractEdmEntityType(final Edm edm, final FullQualifiedName typeName, final FullQualifiedName baseTypeName,
@@ -111,7 +115,8 @@ public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType im
public boolean hasStream() {
return hasStream;
}
-
+
+ @Override
protected void checkBaseType() {
//Current Client implementation doesn`t need this so I implemented an empty body here.
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
index 1346054..20f7c92 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.commons.core.edm;
+import java.util.Collections;
import java.util.List;
import org.apache.olingo.commons.api.edm.EdmAction;
@@ -28,17 +29,26 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
public abstract class AbstractEdmSchemaImpl implements EdmSchema {
protected final String namespace;
+
private final String alias;
+
private List<EdmTypeDefinition> typeDefinitions;
+
private List<EdmEnumType> enumTypes;
+
private List<EdmEntityType> entityTypes;
+
private List<EdmComplexType> complexTypes;
+
private List<EdmAction> actions;
+
private List<EdmFunction> functions;
+
private EdmEntityContainer entityContainer;
public AbstractEdmSchemaImpl(String namespace, String alias) {
@@ -117,6 +127,22 @@ public abstract class AbstractEdmSchemaImpl implements EdmSchema {
}
@Override
+ public List<EdmEntityContainer> getEntityContainers() {
+ return Collections.singletonList(getEntityContainer());
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
+ return getEntityContainer() == null
+ ? null
+ : name == null
+ ? getEntityContainer()
+ : name.equals(new FullQualifiedName(getEntityContainer().getNamespace(), getEntityContainer().getName()))
+ ? getEntityContainer()
+ : null;
+ }
+
+ @Override
public String getNamespace() {
return namespace;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aeb66aa8/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
index 021d3bd..c6360d8 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
@@ -36,11 +36,13 @@ import org.apache.olingo.server.api.edm.provider.PropertyRef;
public class EdmEntityTypeImpl extends AbstractEdmEntityType {
private final EdmStructuredTypeHelper helper;
+
private EntityType entityType;
+
private boolean baseTypeChecked = false;
public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName name,
- final EntityType entityType) {
+ final EntityType entityType) {
final EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, name, entityType);
return instance;
@@ -85,5 +87,10 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
baseTypeChecked = true;
}
}
-
+
+ @Override
+ public boolean isOpenType() {
+ return entityType.isOpenType();
+ }
+
}
[34/51] [abbrv] [OLINGO-168] More TechProvider Refactoring
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java
index fd93d5d..291d893 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java
@@ -31,25 +31,35 @@ import org.apache.olingo.server.api.edm.provider.ReferentialConstraint;
public class EntityTypeProvider {
public static final FullQualifiedName nameETAllKey = new FullQualifiedName(SchemaProvider.nameSpace, "ETAllKey");
- public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(SchemaProvider.nameSpace, "ETAllNullable");
+ public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETAllNullable");
public static final FullQualifiedName nameETAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETAllPrim");
public static final FullQualifiedName nameETBase = new FullQualifiedName(SchemaProvider.nameSpace, "ETBase");
- public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "ETBaseTwoKeyNav");
+ public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETBaseTwoKeyNav");
public static final FullQualifiedName nameETBaseTwoKeyTwoPrim =
new FullQualifiedName(SchemaProvider.nameSpace, "ETBaseTwoKeyTwoPrim");
- public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETCollAllPrim");
- public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompAllPrim");
- public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompCollAllPrim");
- public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompCollComp");
+ public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETCollAllPrim");
+ public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETCompAllPrim");
+ public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETCompCollAllPrim");
+ public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETCompCollComp");
public static final FullQualifiedName nameETCompComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompComp");
public static final FullQualifiedName nameETCompMixPrimCollComp =
new FullQualifiedName(SchemaProvider.nameSpace, "ETCompMixPrimCollComp");
- public static final FullQualifiedName nameETFourKeyAlias = new FullQualifiedName(SchemaProvider.nameSpace, "ETFourKeyAlias");
+ public static final FullQualifiedName nameETFourKeyAlias = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETFourKeyAlias");
public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "ETKeyNav");
- public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(SchemaProvider.nameSpace, "ETKeyPrimNav");
- public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETKeyTwoKeyComp");
+ public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETKeyPrimNav");
+ public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETKeyTwoKeyComp");
public static final FullQualifiedName nameETMedia = new FullQualifiedName(SchemaProvider.nameSpace, "ETMedia");
- public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETMixPrimCollComp");
+ public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETMixPrimCollComp");
public static final FullQualifiedName nameETServerSidePaging =
new FullQualifiedName(SchemaProvider.nameSpace, "ETServerSidePaging");
public static final FullQualifiedName nameETTwoBase = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoBase");
@@ -57,8 +67,10 @@ public class EntityTypeProvider {
new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoBaseTwoKeyNav");
public static final FullQualifiedName nameETTwoBaseTwoKeyTwoPrim =
new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoBaseTwoKeyTwoPrim");
- public static final FullQualifiedName nameETTwoKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoKeyNav");
- public static final FullQualifiedName nameETTwoKeyTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoKeyTwoPrim");
+ public static final FullQualifiedName nameETTwoKeyNav =
+ new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoKeyNav");
+ public static final FullQualifiedName nameETTwoKeyTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace,
+ "ETTwoKeyTwoPrim");
public static final FullQualifiedName nameETTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoPrim");
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
@@ -74,7 +86,9 @@ public class EntityTypeProvider {
PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDecimal,
PropertyProvider.propertyBinary, PropertyProvider.propertyDate, PropertyProvider.propertyDateTimeOffset,
PropertyProvider.propertyDuration, PropertyProvider.propertyGuid, PropertyProvider.propertyTimeOfDay
- /* TODO add propertyStream */));
+ /* TODO add propertyStream */))
+ .setNavigationProperties(Arrays.asList(PropertyProvider.navPropertyETTwoPrimOne_ETTwoPrim,
+ PropertyProvider.collectionNavPropertyETTwoPrimMany_ETTwoPrim));
} else if (entityTypeName.equals(nameETCollAllPrim)) {
return new EntityType()
@@ -98,7 +112,10 @@ public class EntityTypeProvider {
.setName("ETTwoPrim")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString));
+ PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString))
+ .setNavigationProperties(
+ Arrays.asList(PropertyProvider.navPropertyETAllPrimOne_ETAllPrim,
+ PropertyProvider.collectionNavPropertyETAllPrimMany_ETAllPrim));
} else if (entityTypeName.equals(nameETMixPrimCollComp)) {
return new EntityType()
@@ -163,14 +180,14 @@ public class EntityTypeProvider {
new PropertyRef().setPropertyName("PropertyTimeOfDay")))
.setProperties(
Arrays.asList(
- PropertyProvider.propertyString, PropertyProvider.propertyBoolean,
- PropertyProvider.propertyByte, PropertyProvider.propertySByte,
- PropertyProvider.propertyInt16, PropertyProvider.propertyInt32, PropertyProvider.propertyInt64,
- PropertyProvider.propertyDecimal, PropertyProvider.propertyDate,
- PropertyProvider.propertySingle, PropertyProvider.propertyDouble,
- PropertyProvider.propertyDateTimeOffset,
- PropertyProvider.propertyDuration, PropertyProvider.propertyGuid,
- PropertyProvider.propertyTimeOfDay /* TODO add propertyStream */));
+ PropertyProvider.propertyString_NotNullable, PropertyProvider.propertyBoolean_NotNullable,
+ PropertyProvider.propertyByte_NotNullable, PropertyProvider.propertySByte_NotNullable,
+ PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyInt32_NotNullable,
+ PropertyProvider.propertyInt64_NotNullable,
+ PropertyProvider.propertyDecimal_NotNullable, PropertyProvider.propertyDate_NotNullable,
+ PropertyProvider.propertyDateTimeOffset_NotNullable,
+ PropertyProvider.propertyDuration_NotNullable, PropertyProvider.propertyGuid_NotNullable,
+ PropertyProvider.propertyTimeOfDay_NotNullable /* TODO add propertyStream */));
} else if (entityTypeName.equals(nameETCompAllPrim)) {
return new EntityType()
@@ -181,11 +198,11 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETCompCollAllPrim)) {
return new EntityType()
- .setName("ETCompAllPrim")
+ .setName("ETCompCollAllPrim")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
+ Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
PropertyProvider.propertyComplex_CTCollAllPrim));
} else if (entityTypeName.equals(nameETCompComp)) {
@@ -205,7 +222,7 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETMedia)) {
return new EntityType()
- .setName("ETCompCollComp")
+ .setName("ETMedia")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable))
.setHasStream(true);
@@ -232,9 +249,10 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETServerSidePaging)) {
return new EntityType()
- .setName("ETKeyTwoKeyComp")
+ .setName(nameETServerSidePaging.getName())
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString));
+ .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
+ PropertyProvider.propertyString_NotNullable));
} else if (entityTypeName.equals(nameETAllNullable)) {
return new EntityType()
@@ -243,26 +261,32 @@ public class EntityTypeProvider {
.setProperties(
Arrays.asList(
new Property()
- .setName("PropertyKey").setType(PropertyProvider.nameInt16),
- PropertyProvider.propertyInt16,
- PropertyProvider.propertyString, PropertyProvider.propertyBoolean,
- PropertyProvider.propertyByte, PropertyProvider.propertySByte,
- PropertyProvider.propertyInt32, PropertyProvider.propertyInt64,
- PropertyProvider.propertySingle, PropertyProvider.propertyDouble,
- PropertyProvider.propertyDecimal, PropertyProvider.propertyBinary, PropertyProvider.propertyDate,
- PropertyProvider.propertyDateTimeOffset,
- PropertyProvider.propertyDuration, PropertyProvider.propertyGuid,
- PropertyProvider.propertyTimeOfDay /* TODO add propertyStream */,
- PropertyProvider.collPropertyString, PropertyProvider.collPropertyBoolean,
- PropertyProvider.collPropertyByte, PropertyProvider.collPropertySByte,
- PropertyProvider.collPropertyInt16,
- PropertyProvider.collPropertyInt32, PropertyProvider.collPropertyInt64,
- PropertyProvider.collPropertySingle, PropertyProvider.collPropertyDouble,
- PropertyProvider.collPropertyDecimal, PropertyProvider.collPropertyBinary,
- PropertyProvider.collPropertyDate,
- PropertyProvider.collPropertyDateTimeOffset,
- PropertyProvider.collPropertyDuration, PropertyProvider.collPropertyGuid,
- PropertyProvider.collPropertyTimeOfDay /* TODO add propertyStream */));
+ .setName("PropertyKey").setType(PropertyProvider.nameInt16).setNullable(false),
+ PropertyProvider.propertyInt16_ExplicitNullable, PropertyProvider.propertyString_ExplicitNullable,
+ PropertyProvider.propertyBoolean_ExplicitNullable, PropertyProvider.propertyByte_ExplicitNullable,
+ PropertyProvider.propertySByte_ExplicitNullable, PropertyProvider.propertyInt32_ExplicitNullable,
+ PropertyProvider.propertyInt64_ExplicitNullable, PropertyProvider.propertySingle_ExplicitNullable,
+ PropertyProvider.propertyDouble_ExplicitNullable, PropertyProvider.propertyDecimal_ExplicitNullable,
+ PropertyProvider.propertyBinary_ExplicitNullable, PropertyProvider.propertyDate_ExplicitNullable,
+ PropertyProvider.propertyDateTimeOffset_ExplicitNullable,
+ PropertyProvider.propertyDuration_ExplicitNullable, PropertyProvider.propertyGuid_ExplicitNullable,
+ PropertyProvider.propertyTimeOfDay_ExplicitNullable /* TODO add propertyStream */,
+ PropertyProvider.collPropertyString_ExplicitNullable,
+ PropertyProvider.collPropertyBoolean_ExplicitNullable,
+ PropertyProvider.collPropertyByte_ExplicitNullable,
+ PropertyProvider.collPropertySByte_ExplicitNullable,
+ PropertyProvider.collPropertyInt16_ExplicitNullable,
+ PropertyProvider.collPropertyInt32_ExplicitNullable,
+ PropertyProvider.collPropertyInt64_ExplicitNullable,
+ PropertyProvider.collPropertySingle_ExplicitNullable,
+ PropertyProvider.collPropertyDouble_ExplicitNullable,
+ PropertyProvider.collPropertyDecimal_ExplicitNullable,
+ PropertyProvider.collPropertyBinary_ExplicitNullable,
+ PropertyProvider.collPropertyDate_ExplicitNullable,
+ PropertyProvider.collPropertyDateTimeOffset_ExplicitNullable,
+ PropertyProvider.collPropertyDuration_ExplicitNullable,
+ PropertyProvider.collPropertyGuid_ExplicitNullable,
+ PropertyProvider.collPropertyTimeOfDay_ExplicitNullable /* TODO add propertyStream */));
} else if (entityTypeName.equals(nameETKeyNav)) {
return new EntityType()
@@ -280,7 +304,7 @@ public class EntityTypeProvider {
))
.setNavigationProperties(
Arrays.asList(
- PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav,
+ PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav_NotNullable,
PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
PropertyProvider.navPropertyETKeyNavOne_ETKeyNav,
PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav,
@@ -289,19 +313,13 @@ public class EntityTypeProvider {
));
} else if (entityTypeName.equals(nameETKeyPrimNav)) {
return new EntityType()
- .setName("ETKeyNav")
+ .setName("ETKeyPrimNav")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable))
+ PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_ExplicitNullable))
.setNavigationProperties(
Arrays.asList(
- PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav,
- PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- PropertyProvider.navPropertyETKeyNavOne_ETKeyNav,
- PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav,
- PropertyProvider.navPropertyETMediaOne_ETMedia,
- PropertyProvider.collectionNavPropertyETMediaMany_ETMedia
- ));
+ PropertyProvider.navPropertyETKeyPrimNavOne_ETKeyPrimNav));
} else if (entityTypeName.equals(nameETTwoKeyNav)) {
return new EntityType()
@@ -311,9 +329,10 @@ public class EntityTypeProvider {
new PropertyRef().setPropertyName("PropertyString")))
.setProperties(
Arrays.asList(
- PropertyProvider.propertyInt16, PropertyProvider.propertyString,
+ PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable,
PropertyProvider.propertyComplex_CTPrimComp_NotNullable,
- new Property().setName("PropertyComplexNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav),
+ new Property().setName("PropertyComplexNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav)
+ .setNullable(false),
PropertyProvider.propertyComplexEnum_CTPrimEnum_NotNullable,
PropertyProvider.collPropertyComplex_CTPrimComp,
new Property().setName("CollPropertyComplexNav").setType(ComplexTypeProvider.nameCTNavFiveProp)
@@ -337,27 +356,23 @@ public class EntityTypeProvider {
return new EntityType()
.setName("ETBaseTwoKeyNav")
.setBaseType(nameETTwoKeyNav)
- .setProperties(Arrays.asList(PropertyProvider.propertyDate))
+ .setProperties(Arrays.asList(PropertyProvider.propertyDate_ExplicitNullable))
.setNavigationProperties(Arrays.asList(
new NavigationProperty()
- .setName("NavPropertyETBaseTwoKeyNav")
+ .setName("NavPropertyETBaseTwoKeyNavOne")
.setType(nameETBaseTwoKeyNav),
new NavigationProperty()
- .setName("NavPropertyETTwoBaseTwoKeyNav")
- .setType(nameETTwoBaseTwoKeyNav)))
- .setHasStream(true);
+ .setName("NavPropertyETTwoBaseTwoKeyNavOne")
+ .setType(nameETTwoBaseTwoKeyNav)));
} else if (entityTypeName.equals(nameETTwoBaseTwoKeyNav)) {
return new EntityType()
.setName("ETTwoBaseTwoKeyNav")
.setBaseType(nameETBaseTwoKeyNav)
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(PropertyProvider.propertyGuid))
+ .setProperties(Arrays.asList(PropertyProvider.propertyGuid_ExplicitNullable))
.setNavigationProperties(Arrays.asList(
new NavigationProperty()
- .setName("NavPropertyETBaseTwoKeyNavOne")
- .setType(nameETBaseTwoKeyNav),
- new NavigationProperty()
.setName("NavPropertyETBaseTwoKeyNavMany")
.setType(nameETBaseTwoKeyNav)
.setCollection(true)
@@ -377,7 +392,7 @@ public class EntityTypeProvider {
.setPropertyName("PropertyComplexComplex/PropertyComplex/PropertyString")
.setAlias("KeyAlias3")))
.setProperties(
- Arrays.asList(PropertyProvider.propertyGuid, PropertyProvider.propertyComplex_CTTwoPrim,
+ Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTTwoPrim,
PropertyProvider.propertyComplexComplex_CTCompComp));
} else if (entityTypeName.equals(nameETCompMixPrimCollComp)) {
return new EntityType()
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java
index 0640a99..e843955 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java
@@ -22,6 +22,7 @@ import java.util.Arrays;
import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.apache.olingo.server.api.edm.provider.EnumMember;
import org.apache.olingo.server.api.edm.provider.EnumType;
@@ -33,6 +34,8 @@ public class EnumTypeProvider {
if (enumTypeName.equals(nameENString)) {
return new EnumType()
.setName("ENString")
+ .setFlags(true)
+ .setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
.setMembers(Arrays.asList(
new EnumMember().setName("String1").setValue("1"),
new EnumMember().setName("String2").setValue("2"),
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java
index f9e15ec..fe6fefb 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java
@@ -112,21 +112,19 @@ public class FunctionProvider {
public static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav =
new FullQualifiedName(SchemaProvider.nameSpace, "BFESTwoKeyNavRTESTwoKeyNav");
- // TODO: warum BAET?
- public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav =
- new FullQualifiedName(SchemaProvider.nameSpace, "BAETTwoKeyNavRTETTwoKeyNav");
-
// Unbound Functions
public static final FullQualifiedName nameUFCRTCollCTTwoPrim =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCollCTTwoPrim");
public static final FullQualifiedName nameUFCRTCollCTTwoPrimParam =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCollCTTwoPrimParam");
- public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCollString");
+ public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UFCRTCollString");
public static final FullQualifiedName nameUFCRTCollStringTwoParam =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCollStringTwoParam");
public static final FullQualifiedName nameUFCRTCTAllPrimTwoParam =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCTAllPrimTwoParam");
- public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCTTwoPrim");
+ public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UFCRTCTTwoPrim");
public static final FullQualifiedName nameUFCRTCTTwoPrimParam =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCTTwoPrimParam");
public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam =
@@ -135,8 +133,10 @@ public class FunctionProvider {
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTESTwoKeyNavParam");
public static final FullQualifiedName nameUFCRTETAllPrimTwoParam =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETAllPrimTwoParam");
- public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETKeyNav");
- public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETMedia");
+ public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UFCRTETKeyNav");
+ public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UFCRTETMedia");
public static final FullQualifiedName nameUFCRTETTwoKeyNavParam =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETTwoKeyNavParam");
@@ -144,7 +144,8 @@ public class FunctionProvider {
public static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETTwoKeyNavParamCTTwoPrim");
- public static final FullQualifiedName nameUFCRTString = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTString");
+ public static final FullQualifiedName nameUFCRTString =
+ new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTString");
public static final FullQualifiedName nameUFCRTStringTwoParam =
new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTStringTwoParam");
@@ -154,6 +155,15 @@ public class FunctionProvider {
public static final FullQualifiedName nameUFNRTInt16 =
new FullQualifiedName(SchemaProvider.nameSpace, "UFNRTInt16");
+ public static final FullQualifiedName nameUFNRTCollCTNavFiveProp = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UFNRTCollCTNavFiveProp");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTCTNavFiveProp = new FullQualifiedName(
+ SchemaProvider.nameSpace, "BFCESTwoKeyNavRTCTNavFiveProp");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTNavFiveProp = new FullQualifiedName(
+ SchemaProvider.nameSpace, "BFCESTwoKeyNavRTCollCTNavFiveProp");
+
public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
if (functionName.equals(nameUFNRTInt16)) {
@@ -162,7 +172,7 @@ public class FunctionProvider {
.setName("UFNRTInt16")
.setParameters(new ArrayList<Parameter>())
.setReturnType(
- new ReturnType().setType(PropertyProvider.nameString))
+ new ReturnType().setType(PropertyProvider.nameInt16))
);
} else if (functionName.equals(nameUFCRTETKeyNav)) {
@@ -172,7 +182,7 @@ public class FunctionProvider {
.setParameters(new ArrayList<Parameter>())
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav))
+ new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
);
} else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) {
@@ -180,10 +190,10 @@ public class FunctionProvider {
new Function()
.setName("UFCRTETTwoKeyNavParam")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)
)
);
@@ -192,10 +202,11 @@ public class FunctionProvider {
new Function()
.setName("UFCRTETTwoKeyNavParamCTTwoPrim")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterCTTwoPrim").setType(ComplexTypeProvider.nameCTTwoPrim)))
+ new Parameter().setName("ParameterCTTwoPrim").setType(ComplexTypeProvider.nameCTTwoPrim)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)
)
);
@@ -206,22 +217,24 @@ public class FunctionProvider {
.setParameters(Arrays.asList(
new Parameter()
.setName("ParameterInt16")
- .setType(PropertyProvider.nameInt16)))
+ .setType(PropertyProvider.nameInt16)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(PropertyProvider.nameString)),
+ new ReturnType().setType(PropertyProvider.nameString).setNullable(false)),
new Function()
.setName("UFCRTStringTwoParam")
.setParameters(Arrays.asList(
new Parameter()
.setName("ParameterString")
- .setType(PropertyProvider.nameString),
+ .setType(PropertyProvider.nameString)
+ .setNullable(false),
new Parameter()
.setName("ParameterInt16")
- .setType(PropertyProvider.nameInt16)))
+ .setType(PropertyProvider.nameInt16)
+ .setNullable(false)))
.setComposable(true)
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameString))
+ .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setNullable(false))
);
@@ -232,10 +245,11 @@ public class FunctionProvider {
.setParameters(Arrays.asList(
new Parameter()
.setName("ParameterInt16")
- .setType(PropertyProvider.nameInt16)))
+ .setType(PropertyProvider.nameInt16)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameUFCRTString)) {
@@ -247,7 +261,7 @@ public class FunctionProvider {
.setParameters(new ArrayList<Parameter>())
.setComposable(true)
.setReturnType(
- new ReturnType().setType(PropertyProvider.nameString)
+ new ReturnType().setType(PropertyProvider.nameString).setNullable(false)
)
);
@@ -256,11 +270,11 @@ public class FunctionProvider {
new Function()
.setName("UFCRTCollStringTwoParam")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setCollection(true))
+ new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCollString)) {
@@ -270,7 +284,7 @@ public class FunctionProvider {
.setParameters(new ArrayList<Parameter>())
.setComposable(true)
.setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setCollection(true))
+ new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) {
@@ -278,11 +292,11 @@ public class FunctionProvider {
new Function()
.setName("UFCRTCTAllPrimTwoParam")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim))
+ new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCTTwoPrimParam)) {
@@ -290,22 +304,22 @@ public class FunctionProvider {
new Function()
.setName("UFCRTCTTwoPrimParam")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false),
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim))
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCollCTTwoPrimParam)) {
return Arrays.asList(
new Function()
.setName("UFCRTCollCTTwoPrimParam")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false),
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCTTwoPrim)) {
@@ -315,17 +329,17 @@ public class FunctionProvider {
.setParameters(new ArrayList<Parameter>())
.setComposable(true)
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim))
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
return Arrays.asList(
new Function()
- .setName("UFCRTCTTwoPrim")
-
+ .setName("UFCRTCollCTTwoPrim")
+ .setComposable(true)
.setParameters(new ArrayList<Parameter>())
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameUFCRTETMedia)) {
@@ -333,28 +347,9 @@ public class FunctionProvider {
new Function()
.setName("UFCRTETMedia")
.setParameters(new ArrayList<Parameter>())
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETMedia))
- );
-
- } else if (functionName.equals(nameUFCRTString)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTString")
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(new ReturnType()
- .setType(PropertyProvider.nameString)
- )
- );
-
- } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollCTTwoPrim")
.setComposable(true)
- .setParameters(new ArrayList<Parameter>())
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETMedia).setNullable(false))
);
} else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) {
@@ -362,11 +357,12 @@ public class FunctionProvider {
new Function()
.setName("UFNRTESMixPrimCollCompTwoParam")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
.setComposable(false)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true)
+ .setNullable(false))
);
} else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) {
@@ -374,11 +370,11 @@ public class FunctionProvider {
new Function()
.setName("UFCRTETAllPrimTwoParam")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim))
+ new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setNullable(false))
);
} else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) {
@@ -386,14 +382,22 @@ public class FunctionProvider {
new Function()
.setName("UFCRTESMixPrimCollCompTwoParam")
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)
))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true)
+ .setNullable(false))
);
+ } else if (functionName.equals(nameUFNRTCollCTNavFiveProp)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFNRTCollCTNavFiveProp")
+ .setReturnType(
+ new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setCollection(true))
+ );
} else if (functionName.equals(nameBFCESTwoKeyNavRTESTwoKeyNav)) {
return Arrays
.asList(
@@ -403,10 +407,11 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)),
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)
+ .setNullable(false)),
new Function()
.setName("BFCESTwoKeyNavRTESTwoKeyNav")
@@ -414,33 +419,36 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true),
+ .setCollection(true).setNullable(false),
new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
- .setCollection(false)))
+ .setCollection(false).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)),
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)
+ .setNullable(false)),
new Function()
.setName("BFCESTwoKeyNavRTESTwoKeyNav")
.setBound(true)
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)),
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)
+ .setNullable(false)),
new Function()
.setName("BFCESTwoKeyNavRTESTwoKeyNav")
.setBound(true)
.setParameters(
Arrays.asList(new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav)
- .setCollection(true),
+ .setCollection(true).setNullable(false),
new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
- .setCollection(false)))
+ .setCollection(false).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)
+ .setNullable(false))
);
} else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) {
@@ -448,10 +456,10 @@ public class FunctionProvider {
new Function().setName("BFCStringRTESTwoKeyNav")
.setBound(true)
.setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(PropertyProvider.nameString)))
+ new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) {
@@ -460,10 +468,11 @@ public class FunctionProvider {
.setName("BFCETBaseTwoKeyNavRTETTwoKeyNav")
.setBound(true)
.setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)))
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)
)
);
@@ -474,10 +483,11 @@ public class FunctionProvider {
.setBound(true)
.setParameters(Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true)
+ .setNullable(false))
);
} else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) {
@@ -487,11 +497,11 @@ public class FunctionProvider {
.setBound(true)
.setParameters(
Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETAllPrim).setCollection(
- true)))
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETAllPrim)
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim))
+ new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim).setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) {
@@ -502,10 +512,10 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim))
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) {
@@ -516,10 +526,10 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTString)) {
@@ -530,10 +540,10 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(PropertyProvider.nameString))
+ new ReturnType().setType(PropertyProvider.nameString).setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) {
@@ -544,10 +554,10 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setCollection(true))
+ new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) {
@@ -556,10 +566,11 @@ public class FunctionProvider {
.setName("BFCETTwoKeyNavRTESTwoKeyNav")
.setBound(true)
.setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)))
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) {
@@ -567,11 +578,13 @@ public class FunctionProvider {
new Function()
.setName("BFCETBaseTwoKeyNavRTESTwoKeyNav")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) {
@@ -579,11 +592,13 @@ public class FunctionProvider {
new Function()
.setName("BFCSINavRTESTwoKeyNav")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(
+ false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) {
@@ -591,11 +606,14 @@ public class FunctionProvider {
new Function()
.setName("BFCETBaseTwoKeyNavRTESBaseTwoKey")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true).setNullable(
+ false))
);
} else if (functionName.equals(nameBFCCollStringRTESTwoKeyNav)) {
@@ -603,10 +621,13 @@ public class FunctionProvider {
new Function()
.setName("BFCCollStringRTESTwoKeyNav")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setCollection(true)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setCollection(true)
+ .setNullable(false)))
.setComposable(true)
- .setReturnType(new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ .setReturnType(
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) {
@@ -614,11 +635,13 @@ public class FunctionProvider {
new Function()
.setName("BFCCTPrimCompRTESTwoKeyNav")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable(
+ false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) {
@@ -626,11 +649,14 @@ public class FunctionProvider {
new Function()
.setName("BFCCTPrimCompRTESBaseTwoKeyNav")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable(
+ false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true).setNullable(
+ false))
);
} else if (functionName.equals(nameBFCCollCTPrimCompRTESAllPrim)) {
@@ -641,10 +667,10 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true).setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) {
@@ -655,10 +681,10 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false))
);
} else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) {
@@ -667,11 +693,13 @@ public class FunctionProvider {
new Function()
.setName("BFCESKeyNavRTETKeyNav")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection(true)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection(
+ true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav))
+ new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
);
} else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) {
@@ -680,10 +708,10 @@ public class FunctionProvider {
.setName("BFCETKeyNavRTETKeyNav")
.setBound(true)
.setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav)))
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav))
+ new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
);
} else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) {
return Arrays.asList(
@@ -693,9 +721,10 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true)))
+ .setCollection(true).setNullable(false)))
.setComposable(true)
- .setReturnType(new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ .setReturnType(
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
@@ -704,11 +733,13 @@ public class FunctionProvider {
new Function()
.setName("BFCETTwoKeyNavRTETTwoKeyNav")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(
+ false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false))
);
} else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) {
@@ -716,11 +747,40 @@ public class FunctionProvider {
new Function()
.setName("BFCETTwoKeyNavRTCTTwoPrim")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(
+ false)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTCTNavFiveProp)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTCTNavFiveProp")
+ .setBound(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setCollection(true).setNullable(false)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setNullable(false))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTNavFiveProp)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTCollCTNavFiveProp")
+ .setBound(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setCollection(true).setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim))
+ new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setCollection(true)
+ .setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) {
return Arrays.asList(
@@ -730,11 +790,12 @@ public class FunctionProvider {
.setParameters(
Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true),
- new Parameter().setName("ParameterComplex").setType(ComplexTypeProvider.nameCTTwoPrim)))
+ .setCollection(true).setNullable(false),
+ new Parameter().setName("ParameterComplex").setType(ComplexTypeProvider.nameCTTwoPrim)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(PropertyProvider.nameString))
+ new ReturnType().setType(PropertyProvider.nameString).setNullable(false))
);
} else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) {
@@ -742,49 +803,46 @@ public class FunctionProvider {
new Function()
.setName("BFCESKeyNavRTETKeyNavParam")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection(true),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection(
+ true).setNullable(false),
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav))
+ new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
);
} else if (functionName.equals(nameBFCCTPrimCompRTETTwoKeyNavParam)) {
return Arrays.asList(
new Function()
.setName("BFCCTPrimCompRTETTwoKeyNavParam")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable(
+ false),
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(new ReturnType()
- .setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)
)
);
- } else if (functionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BAETTwoKeyNavRTETTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(PropertyProvider.nameInt16).setCollection(true),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))
- );
} else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNavParam)) {
return Arrays.asList(
new Function()
.setName("BFCCTPrimCompRTESTwoKeyNavParam")
.setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)))
+ .setParameters(
+ Arrays.asList(
+ new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable(
+ false),
+ new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
+ .setNullable(false)))
.setComposable(true)
.setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6a3a4a1d/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
index a237ebd..6dc2399 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
@@ -54,112 +54,304 @@ public class PropertyProvider {
.setName("CollPropertyBinary")
.setType(nameBinary)
.setCollection(true);
+
+ public static final Property collPropertyBinary_ExplicitNullable = new Property()
+ .setName("CollPropertyBinary")
+ .setType(nameBinary)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyBoolean = new Property()
.setName("CollPropertyBoolean")
.setType(nameBoolean)
.setCollection(true);
+
+ public static final Property collPropertyBoolean_ExplicitNullable = new Property()
+ .setName("CollPropertyBoolean")
+ .setType(nameBoolean)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyByte = new Property()
.setName("CollPropertyByte")
.setType(nameByte)
.setCollection(true);
+ public static final Property collPropertyByte_ExplicitNullable = new Property()
+ .setName("CollPropertyByte")
+ .setType(nameByte)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyDate = new Property()
.setName("CollPropertyDate")
.setType(nameDate)
.setCollection(true);
+
+ public static final Property collPropertyDate_ExplicitNullable = new Property()
+ .setName("CollPropertyDate")
+ .setType(nameDate)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyDateTimeOffset = new Property()
.setName("CollPropertyDateTimeOffset")
.setType(nameDateTimeOffset)
.setCollection(true);
+
+ public static final Property collPropertyDateTimeOffset_ExplicitNullable = new Property()
+ .setName("CollPropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyDecimal = new Property()
.setName("CollPropertyDecimal")
.setType(nameDecimal)
.setCollection(true);
+
+ public static final Property collPropertyDecimal_ExplicitNullable = new Property()
+ .setName("CollPropertyDecimal")
+ .setType(nameDecimal)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyDouble = new Property()
.setName("CollPropertyDouble")
.setType(nameDouble)
.setCollection(true);
+
+ public static final Property collPropertyDouble_ExplicitNullable = new Property()
+ .setName("CollPropertyDouble")
+ .setType(nameDouble)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyDuration = new Property()
.setName("CollPropertyDuration")
.setType(nameDuration)
.setCollection(true);
+
+ public static final Property collPropertyDuration_ExplicitNullable = new Property()
+ .setName("CollPropertyDuration")
+ .setType(nameDuration)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyGuid = new Property()
.setName("CollPropertyGuid")
.setType(nameGuid)
.setCollection(true);
+
+ public static final Property collPropertyGuid_ExplicitNullable = new Property()
+ .setName("CollPropertyGuid")
+ .setType(nameGuid)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyInt16 = new Property()
.setName("CollPropertyInt16")
.setType(nameInt16)
.setCollection(true);
+
+ public static final Property collPropertyInt16_ExplicitNullable = new Property()
+ .setName("CollPropertyInt16")
+ .setType(nameInt16)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyInt32 = new Property()
.setName("CollPropertyInt32")
.setType(nameInt32)
.setCollection(true);
+
+ public static final Property collPropertyInt32_ExplicitNullable = new Property()
+ .setName("CollPropertyInt32")
+ .setType(nameInt32)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertyInt64 = new Property()
.setName("CollPropertyInt64")
.setType(nameInt64)
.setCollection(true);
+
+ public static final Property collPropertyInt64_ExplicitNullable = new Property()
+ .setName("CollPropertyInt64")
+ .setType(nameInt64)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertySByte = new Property()
.setName("CollPropertySByte")
.setType(nameSByte)
.setCollection(true);
+ public static final Property collPropertySByte_ExplicitNullable = new Property()
+ .setName("CollPropertySByte")
+ .setType(nameSByte)
+ .setNullable(true)
+ .setCollection(true);
+
public static final Property collPropertySingle = new Property()
.setName("CollPropertySingle")
.setType(nameSingle)
.setCollection(true);
+
+ public static final Property collPropertySingle_ExplicitNullable = new Property()
+ .setName("CollPropertySingle")
+ .setType(nameSingle)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyString = new Property()
.setName("CollPropertyString")
.setType(nameString)
.setCollection(true);
+
+ public static final Property collPropertyString_ExplicitNullable = new Property()
+ .setName("CollPropertyString")
+ .setType(nameString)
+ .setNullable(true)
+ .setCollection(true);
public static final Property collPropertyTimeOfDay = new Property()
- .setName("CollPropertyTimeOfDay")
- .setType(nameTimeOfDay)
- .setCollection(true);
+ .setName("CollPropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setCollection(true);
+
+ public static final Property collPropertyTimeOfDay_ExplicitNullable = new Property()
+ .setName("CollPropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setNullable(true)
+ .setCollection(true);
public static final Property propertyBinary = new Property()
.setName("PropertyBinary")
.setType(nameBinary);
+
+ public static final Property propertyBinary_NotNullable = new Property()
+ .setName("PropertyBinary")
+ .setType(nameBinary)
+ .setNullable(false);
+
+ public static final Property propertyBinary_ExplicitNullable = new Property()
+ .setName("PropertyBinary")
+ .setType(nameBinary)
+ .setNullable(true);
+
public static final Property propertyBoolean = new Property()
.setName("PropertyBoolean")
.setType(nameBoolean);
+
+ public static final Property propertyBoolean_NotNullable = new Property()
+ .setName("PropertyBoolean")
+ .setType(nameBoolean)
+ .setNullable(false);
+
+ public static final Property propertyBoolean_ExplicitNullable = new Property()
+ .setName("PropertyBoolean")
+ .setType(nameBoolean)
+ .setNullable(true);
+
public static final Property propertyByte = new Property()
.setName("PropertyByte")
.setType(nameByte);
+ public static final Property propertyByte_NotNullable = new Property()
+ .setName("PropertyByte")
+ .setType(nameByte)
+ .setNullable(false);
+
+ public static final Property propertyByte_ExplicitNullable = new Property()
+ .setName("PropertyByte")
+ .setType(nameByte)
+ .setNullable(true);
+
public static final Property propertyDate = new Property()
.setName("PropertyDate")
.setType(nameDate);
+ public static final Property propertyDate_NotNullable = new Property()
+ .setName("PropertyDate")
+ .setType(nameDate)
+ .setNullable(false);
+
+ public static final Property propertyDate_ExplicitNullable = new Property()
+ .setName("PropertyDate")
+ .setType(nameDate)
+ .setNullable(true);
+
public static final Property propertyDateTimeOffset = new Property()
.setName("PropertyDateTimeOffset")
.setType(nameDateTimeOffset);
+ public static final Property propertyDateTimeOffset_NotNullable = new Property()
+ .setName("PropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setNullable(false);
+
+ public static final Property propertyDateTimeOffset_ExplicitNullable = new Property()
+ .setName("PropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setNullable(true);
+
public static final Property propertyDecimal = new Property()
.setName("PropertyDecimal")
.setType(nameDecimal);
+ public static final Property propertyDecimal_NotNullable = new Property()
+ .setName("PropertyDecimal")
+ .setType(nameDecimal)
+ .setNullable(false);
+
+ public static final Property propertyDecimal_ExplicitNullable = new Property()
+ .setName("PropertyDecimal")
+ .setType(nameDecimal)
+ .setNullable(true);
+
public static final Property propertyDouble = new Property()
.setName("PropertyDouble")
.setType(nameDouble);
+ public static final Property propertyDouble_NotNullable = new Property()
+ .setName("PropertyDouble")
+ .setType(nameDouble)
+ .setNullable(false);
+
+ public static final Property propertyDouble_ExplicitNullable = new Property()
+ .setName("PropertyDouble")
+ .setType(nameDouble)
+ .setNullable(true);
+
public static final Property propertyDuration = new Property()
.setName("PropertyDuration")
.setType(nameDuration);
+ public static final Property propertyDuration_NotNullable = new Property()
+ .setName("PropertyDuration")
+ .setType(nameDuration)
+ .setNullable(false);
+
+ public static final Property propertyDuration_ExplicitNullable = new Property()
+ .setName("PropertyDuration")
+ .setType(nameDuration)
+ .setNullable(true);
+
public static final Property propertyGuid = new Property()
.setName("PropertyGuid")
.setType(nameGuid);
+ public static final Property propertyGuid_NotNullable = new Property()
+ .setName("PropertyGuid")
+ .setType(nameGuid)
+ .setNullable(false);
+
+ public static final Property propertyGuid_ExplicitNullable = new Property()
+ .setName("PropertyGuid")
+ .setType(nameGuid)
+ .setNullable(true);
+
public static final Property propertyInt16 = new Property()
.setName("PropertyInt16")
.setType(nameInt16);
@@ -168,33 +360,96 @@ public class PropertyProvider {
.setName("PropertyInt16")
.setType(nameInt16)
.setNullable(false);
+
+ public static final Property propertyInt16_ExplicitNullable = new Property()
+ .setName("PropertyInt16")
+ .setType(nameInt16)
+ .setNullable(true);
+
public static final Property propertyInt32 = new Property()
.setName("PropertyInt32")
.setType(nameInt32);
+ public static final Property propertyInt32_NotNullable = new Property()
+ .setName("PropertyInt32")
+ .setType(nameInt32)
+ .setNullable(false);
+
+ public static final Property propertyInt32_ExplicitNullable = new Property()
+ .setName("PropertyInt32")
+ .setType(nameInt32)
+ .setNullable(true);
+
public static final Property propertyInt64 = new Property()
.setName("PropertyInt64")
.setType(nameInt64);
+ public static final Property propertyInt64_NotNullable = new Property()
+ .setName("PropertyInt64")
+ .setType(nameInt64)
+ .setNullable(false);
+
+ public static final Property propertyInt64_ExplicitNullable = new Property()
+ .setName("PropertyInt64")
+ .setType(nameInt64)
+ .setNullable(true);
+
public static final Property propertySByte = new Property()
.setName("PropertySByte")
.setType(nameSByte);
+ public static final Property propertySByte_NotNullable = new Property()
+ .setName("PropertySByte")
+ .setType(nameSByte)
+ .setNullable(false);
+
+ public static final Property propertySByte_ExplicitNullable = new Property()
+ .setName("PropertySByte")
+ .setType(nameSByte)
+ .setNullable(true);
+
public static final Property propertySingle = new Property()
.setName("PropertySingle")
.setType(nameSingle);
+ public static final Property propertySingle_NotNullable = new Property()
+ .setName("PropertySingle")
+ .setType(nameSingle)
+ .setNullable(false);
+
+ public static final Property propertySingle_ExplicitNullable = new Property()
+ .setName("PropertySingle")
+ .setType(nameSingle)
+ .setNullable(true);
+
public static final Property propertyString = new Property()
.setName("PropertyString")
.setType(nameString);
public static final Property propertyString_NotNullable = new Property()
.setName("PropertyString")
- .setType(nameString);
+ .setType(nameString)
+ .setNullable(false);
+
+ public static final Property propertyString_ExplicitNullable = new Property()
+ .setName("PropertyString")
+ .setType(nameString)
+ .setNullable(true);
- public static final Property propertyTimeOfDay = new Property().setName("PropertyTimeOfDay")
+ public static final Property propertyTimeOfDay = new Property()
+ .setName("PropertyTimeOfDay")
.setType(nameTimeOfDay);
+ public static final Property propertyTimeOfDay_NotNullable = new Property()
+ .setName("PropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setNullable(false);
+
+ public static final Property propertyTimeOfDay_ExplicitNullable = new Property()
+ .setName("PropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setNullable(true);
+
/*
* TODO add propertyStream
* Property propertyStream = new Property()
@@ -235,7 +490,8 @@ public class PropertyProvider {
public static final Property propertyComplex_CTPrimComp_NotNullable = new Property()
.setName("PropertyComplex")
- .setType(ComplexTypeProvider.nameCTPrimComp);
+ .setType(ComplexTypeProvider.nameCTPrimComp)
+ .setNullable(false);
public static final Property propertyComplex_CTTwoPrim = new Property()
.setName("PropertyComplex")
@@ -251,7 +507,8 @@ public class PropertyProvider {
public static final Property propertyComplexEnum_CTPrimEnum_NotNullable = new Property()
.setName("PropertyComplexEnum")
- .setType(ComplexTypeProvider.nameCTPrimEnum);
+ .setType(ComplexTypeProvider.nameCTPrimEnum)
+ .setNullable(false);
public static final Property propertyComplexTwoPrim_CTTwoPrim = new Property()
.setName("PropertyComplexTwoPrim")
@@ -259,8 +516,7 @@ public class PropertyProvider {
public static final Property propertyMixedPrimCollComp_CTMixPrimCollComp = new Property()
.setName("PropertyMixedPrimCollComp")
- .setType(ComplexTypeProvider.nameCTMixPrimCollComp)
- .setCollection(true);
+ .setType(ComplexTypeProvider.nameCTMixPrimCollComp);
// Navigation Properties -------------------------------------------------------------------------------------------
public static final NavigationProperty collectionNavPropertyETKeyNavMany_ETKeyNav = new NavigationProperty()
@@ -283,21 +539,47 @@ public class PropertyProvider {
.setName("NavPropertyETTwoKeyNavOne")
.setType(EntityTypeProvider.nameETTwoKeyNav);
+ public static final NavigationProperty collectionNavPropertyETTwoPrimMany_ETTwoPrim = new NavigationProperty()
+ .setName("NavPropertyETTwoPrimMany")
+ .setType(EntityTypeProvider.nameETTwoPrim)
+ .setCollection(true)
+ .setNullable(false);
+
+ public static final NavigationProperty collectionNavPropertyETAllPrimMany_ETAllPrim = new NavigationProperty()
+ .setName("NavPropertyETAllPrimMany")
+ .setType(EntityTypeProvider.nameETAllPrim)
+ .setCollection(true);
+
public static final NavigationProperty navPropertyETKeyNavOne_ETKeyNav = new NavigationProperty()
.setName("NavPropertyETKeyNavOne")
.setType(EntityTypeProvider.nameETKeyNav);
+
public static final NavigationProperty navPropertyETMediaOne_ETMedia = new NavigationProperty()
.setName("NavPropertyETMediaOne")
.setType(EntityTypeProvider.nameETMedia);
- public static final NavigationProperty navPropertyETKeyPrimNavOne = new NavigationProperty()
+ public static final NavigationProperty navPropertyETKeyPrimNavOne_ETKeyPrimNav = new NavigationProperty()
.setName("NavPropertyETKeyPrimNavOne")
.setType(EntityTypeProvider.nameETKeyPrimNav);
+ public static final NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav_NotNullable = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavOne")
+ .setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setNullable(false);
+
public static final NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
.setName("NavPropertyETTwoKeyNavOne")
.setType(EntityTypeProvider.nameETTwoKeyNav);
+ public static final NavigationProperty navPropertyETTwoPrimOne_ETTwoPrim = new NavigationProperty()
+ .setName("NavPropertyETTwoPrimOne")
+ .setType(EntityTypeProvider.nameETTwoPrim)
+ .setNullable(false);
+
+ public static final NavigationProperty navPropertyETAllPrimOne_ETAllPrim = new NavigationProperty()
+ .setName("NavPropertyETAllPrimOne")
+ .setType(EntityTypeProvider.nameETAllPrim);
+
// EnumProperties --------------------------------------------------------------------------------------------------
public static final Property propertyEnumString_ENString = new Property()
.setName("PropertyEnumString")
[29/51] [abbrv] git commit: [OLINGO-200] More ref tests
Posted by sk...@apache.org.
[OLINGO-200] More ref tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/6aaec814
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/6aaec814
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/6aaec814
Branch: refs/heads/olingo-206-validator
Commit: 6aaec814c423d14c20db3285b1bbd78173a35ec9
Parents: 525767c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 16:04:24 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 16:04:24 2014 +0200
----------------------------------------------------------------------
.../olingo/client/core/v4/EntitySetTest.java | 32 +++++++++++++--
.../olingo/client/core/v4/EntityTest.java | 23 +++++++++++
.../apache/olingo/client/core/v4/JSONTest.java | 19 +++++++++
.../apache/olingo/client/core/v4/Customers.xml | 42 ++++++++++----------
.../core/v4/collectionOfEntityReferences.json | 11 +++++
.../core/v4/collectionOfEntityReferences.xml | 25 ++++++++++++
.../olingo/client/core/v4/entityReference.json | 4 ++
.../olingo/client/core/v4/entityReference.xml | 22 ++++++++++
.../apache/olingo/commons/api/Constants.java | 4 +-
.../commons/core/data/AbstractAtomDealer.java | 4 +-
.../commons/core/data/AtomDeserializer.java | 27 +++++++------
.../commons/core/data/AtomSerializer.java | 28 ++++++++++---
12 files changed, 195 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/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
index 6708be6..cbca942 100644
--- 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
@@ -25,9 +25,9 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.junit.Test;
@@ -48,8 +48,8 @@ public class EntitySetTest extends AbstractTest {
assertEquals(2, entitySet.getEntities().size());
assertNull(entitySet.getNext());
- final CommonODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
- getBinder().getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+ final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().getBinder().
+ getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entitySet, written);
}
@@ -62,4 +62,30 @@ public class EntitySetTest extends AbstractTest {
public void fromJSON() throws IOException {
read(ODataPubFormat.JSON);
}
+
+ private void ref(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("collectionOfEntityReferences." + getSuffix(format));
+ final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ getClient().getDeserializer().toFeed(input, format).getObject());
+ assertNotNull(entitySet);
+
+ for (ODataEntity entity : entitySet.getEntities()) {
+ assertNotNull(entity.getReference());
+ }
+ entitySet.setCount(entitySet.getEntities().size());
+
+ final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().getBinder().
+ getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entitySet, written);
+ }
+
+ @Test
+ public void atomRef() {
+ ref(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonRef() {
+ ref(ODataPubFormat.JSON);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index e061be6..5b8f586 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -224,4 +224,27 @@ public class EntityTest extends AbstractTest {
public void jsonWithStream() {
withStream(ODataPubFormat.JSON_FULL_METADATA);
}
+
+ private void ref(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ assertNotNull(entity.getReference());
+
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomRef() {
+ ref(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonRef() {
+ ref(ODataPubFormat.JSON);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/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
index 770f112..791c1c7 100644
--- 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
@@ -115,6 +115,20 @@ public class JSONTest extends AbstractTest {
assertEquals(orig, OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes())));
}
+ protected void feed(final String filename, final ODataPubFormat format) throws Exception {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer().feed(getClient().getDeserializer().toFeed(
+ getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+
+ assertSimilar(filename + "." + getSuffix(format), writer.toString());
+ }
+
+ @Test
+ public void feeds() throws Exception {
+ feed("Customers", getODataPubFormat());
+ feed("collectionOfEntityReferences", getODataPubFormat());
+ }
+
protected void entry(final String filename, final ODataPubFormat format) throws Exception {
final StringWriter writer = new StringWriter();
getClient().getSerializer().entry(getClient().getDeserializer().toEntry(
@@ -137,6 +151,8 @@ public class JSONTest extends AbstractTest {
public void entries() throws Exception {
entry("Products_5", getODataPubFormat());
entry("VipCustomer", getODataPubFormat());
+ entry("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
+ entry("entityReference", getODataPubFormat());
}
protected void property(final String filename, final ODataFormat format) throws Exception {
@@ -150,5 +166,8 @@ public class JSONTest extends AbstractTest {
@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());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
index 9b3d870..aa416d2 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
@@ -28,26 +28,26 @@
m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers">
<m:count>2</m:count>
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers</id>
- <title />
+ <title/>
<updated>2014-03-31T09:35:14Z</updated>
<entry>
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)</id>
- <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
- <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company" />
- <title />
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company"/>
+ <title/>
<updated>2014-03-31T09:35:14Z</updated>
<author>
- <name />
+ <name/>
</author>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">1</d:PersonID>
<d:FirstName>Bob</d:FirstName>
<d:LastName>Cat</d:LastName>
- <d:MiddleName m:null="true" />
+ <d:MiddleName m:null="true"/>
<d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress">
<d:Street>1 Microsoft Way</d:Street>
<d:City>London</d:City>
@@ -73,30 +73,30 @@
</entry>
<entry>
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)</id>
- <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
- <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Parent" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Company" />
- <title />
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Parent"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Company"/>
+ <title/>
<updated>2014-03-31T09:35:14Z</updated>
<author>
- <name />
+ <name/>
</author>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">2</d:PersonID>
<d:FirstName>Jill</d:FirstName>
<d:LastName>Jones</d:LastName>
- <d:MiddleName m:null="true" />
- <d:HomeAddress m:null="true" />
+ <d:MiddleName m:null="true"/>
+ <d:HomeAddress m:null="true"/>
<d:Home m:type="GeographyPoint">
<gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pos>15 161.8</gml:pos>
+ <gml:pos>15.0 161.8</gml:pos>
</gml:Point>
</d:Home>
- <d:Numbers m:type="#Collection(String)" />
- <d:Emails m:type="#Collection(String)" />
+ <d:Numbers m:type="#Collection(String)"/>
+ <d:Emails m:type="#Collection(String)"/>
<d:City>Sydney</d:City>
<d:Birthday m:type="DateTimeOffset">1983-01-15T00:00:00Z</d:Birthday>
<d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json
new file mode 100644
index 0000000..7646ee8
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json
@@ -0,0 +1,11 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Collection($ref)",
+ "value": [
+ {
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=5)"
+ },
+ {
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=6)"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml
new file mode 100644
index 0000000..9534270
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<feed xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Collection($ref)"
+ xmlns="http://www.w3.org/2005/Atom">
+ <m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=5)"/>
+ <m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=6)"/>
+</feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json
new file mode 100644
index 0000000..d0b6960
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json
@@ -0,0 +1,4 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#$ref",
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Employees(PersonID=3)"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml
new file mode 100644
index 0000000..d04613b
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<m:ref m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#$ref"
+ id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Employees(PersonID=3)"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"/>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index a1aec31..882c811 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -170,9 +170,9 @@ public interface Constants {
public final static String ATOM_ELEM_ENTRY_REF = "ref";
- public final static String ATOM_ELEM_ENTRY_REF_ID = "id";
+ public final static String ATOM_ATTR_ID = "id";
- public final static QName QNAME_ATOM_ELEM_ENTRY_REF_ID = new QName(ATOM_ELEM_ENTRY_REF_ID);
+ public final static QName QNAME_ATOM_ATTR_ID = new QName(ATOM_ATTR_ID);
public static final QName QNAME_ATOM_ELEM_ENTRY = new QName(NS_ATOM, ATOM_ELEM_ENTRY);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index e9338f1..f4944d6 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -56,7 +56,7 @@ abstract class AbstractAtomDealer {
protected final QName contextQName;
- protected final QName entityRefQName;
+ protected final QName entryRefQName;
protected final QName v4PropertyValueQName;
@@ -92,7 +92,7 @@ abstract class AbstractAtomDealer {
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.NEXT_LINK_REL);
this.contextQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.CONTEXT);
- this.entityRefQName =
+ this.entryRefQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ENTRY_REF);
this.v4PropertyValueQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.VALUE);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index 722ea50..c748f59 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -171,9 +171,20 @@ public class AtomDeserializer extends AbstractAtomDealer {
}
}
+ private AtomEntryImpl entryRef(final StartElement start) throws XMLStreamException {
+ final AtomEntryImpl entry = new AtomEntryImpl();
+
+ final Attribute entryRefId = start.getAttributeByName(Constants.QNAME_ATOM_ATTR_ID);
+ if (entryRefId != null) {
+ entry.setId(entryRefId.getValue());
+ }
+
+ return entry;
+ }
+
private AtomEntryImpl entry(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
final AtomEntryImpl entry;
- if (entityRefQName.equals(start.getName())) {
+ if (entryRefQName.equals(start.getName())) {
entry = entryRef(start);
} else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) {
entry = new AtomEntryImpl();
@@ -296,18 +307,6 @@ public class AtomDeserializer extends AbstractAtomDealer {
return entry;
}
- private AtomEntryImpl entryRef(final StartElement start) throws XMLStreamException {
- final AtomEntryImpl entry = new AtomEntryImpl();
-
- final Attribute entryRefId = start.getAttributeByName(Constants.QNAME_ATOM_ELEM_ENTRY_REF_ID);
-
- if (entryRefId != null) {
- entry.setId(entryRefId.getValue());
- }
-
- return entry;
- }
-
private Container<AtomEntryImpl> entry(final InputStream input) throws XMLStreamException {
final XMLEventReader reader = FACTORY.createXMLEventReader(input);
final StartElement start = skipBeforeFirstStartElement(reader);
@@ -365,6 +364,8 @@ public class AtomDeserializer extends AbstractAtomDealer {
}
} else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
feed.getEntries().add(entry(reader, event.asStartElement()));
+ } else if (entryRefQName.equals(event.asStartElement().getName())) {
+ feed.getEntries().add(entryRef(event.asStartElement()));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
index c3be420..f89aaee 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
@@ -171,12 +171,25 @@ public class AtomSerializer extends AbstractAtomDealer {
writer.writeEndElement();
}
+ private void entryRef(final XMLStreamWriter writer, final Entry entry) throws XMLStreamException {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF);
+ writer.writeNamespace(StringUtils.EMPTY, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+ writer.writeAttribute(Constants.ATOM_ATTR_ID, entry.getId());
+ }
+
private void entry(final Writer outWriter, final Entry entry) throws XMLStreamException {
final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
- startDocument(writer, Constants.ATOM_ELEM_ENTRY);
+ if (entry.getType() == null && entry.getProperties().isEmpty()) {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+
+ entryRef(writer, entry);
+ } else {
+ startDocument(writer, Constants.ATOM_ELEM_ENTRY);
- entry(writer, entry);
+ entry(writer, entry);
+ }
writer.writeEndElement();
writer.writeEndDocument();
@@ -206,9 +219,14 @@ public class AtomSerializer extends AbstractAtomDealer {
}
for (Entry entry : feed.getEntries()) {
- writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
- entry(writer, entry);
- writer.writeEndElement();
+ if (entry.getType() == null && entry.getProperties().isEmpty()) {
+ entryRef(writer, entry);
+ writer.writeEndElement();
+ } else {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
+ entry(writer, entry);
+ writer.writeEndElement();
+ }
}
if (feed.getNext() != null) {
[25/51] [abbrv] git commit: [OLINGO-200] Cleanup again
Posted by sk...@apache.org.
[OLINGO-200] Cleanup again
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/1fa66760
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/1fa66760
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/1fa66760
Branch: refs/heads/olingo-206-validator
Commit: 1fa667608094fb7a59395642b641113959b48798
Parents: a5b7b25
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 14:16:50 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 14:16:50 2014 +0200
----------------------------------------------------------------------
.../commons/core/data/AtomDeserializer.java | 28 +++++++--------
.../core/op/AbstractODataDeserializer.java | 38 ++++++++------------
2 files changed, 26 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1fa66760/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index a786803..722ea50 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -34,14 +34,10 @@ import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.data.v3.XMLLinkCollectionImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class AtomDeserializer extends AbstractAtomDealer {
- private static final Logger LOG = LoggerFactory.getLogger(AtomDeserializer.class);
-
- public static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
+ private static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
private final AtomPropertyDeserializer propDeserializer;
@@ -56,7 +52,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
return getContainer(start, propDeserializer.deserialize(reader, start));
}
- public StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
+ private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
StartElement startEvent = null;
while (reader.hasNext() && startEvent == null) {
final XMLEvent event = reader.nextEvent();
@@ -442,6 +438,16 @@ public class AtomDeserializer extends AbstractAtomDealer {
return getContainer(start, error(reader, start));
}
+ private <T> Container<T> getContainer(final StartElement start, final T object) {
+ final Attribute context = start.getAttributeByName(contextQName);
+ final Attribute metadataETag = start.getAttributeByName(metadataEtagQName);
+
+ return new Container<T>(
+ context == null ? null : URI.create(context.getValue()),
+ metadataETag == null ? null : metadataETag.getValue(),
+ object);
+ }
+
@SuppressWarnings("unchecked")
public <T, V extends T> Container<T> read(final InputStream input, final Class<V> reference)
throws XMLStreamException {
@@ -459,14 +465,4 @@ public class AtomDeserializer extends AbstractAtomDealer {
}
return null;
}
-
- public <T> Container<T> getContainer(final StartElement start, final T object) {
- final Attribute context = start.getAttributeByName(contextQName);
- final Attribute metadataETag = start.getAttributeByName(metadataEtagQName);
-
- return new Container<T>(
- context == null ? null : URI.create(context.getValue()),
- metadataETag == null ? null : metadataETag.getValue(),
- object);
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1fa66760/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index 96043c7..ceb6b7e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -19,14 +19,8 @@
package org.apache.olingo.commons.core.op;
import com.fasterxml.jackson.core.type.TypeReference;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.lang.reflect.Type;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.events.StartElement;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.data.Feed;
@@ -89,38 +83,34 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
/*
* ------------------ Protected methods ------------------
*/
- @SuppressWarnings("unchecked")
- protected <T, V extends T> Container<T> xml(final InputStream input, final Class<V> reference) {
+ protected <T, V extends T> Container<T> atom(final InputStream input, final Class<V> reference) {
try {
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- final XMLEventReader reader = AtomDeserializer.FACTORY.createXMLEventReader(input);
- final StartElement start = atomDeserializer.skipBeforeFirstStartElement(reader);
-
- final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(baos);
- writer.add(start);
- writer.add(reader);
- writer.flush();
- writer.close();
-
- final V obj = getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference);
- return (Container<T>) (obj instanceof Container ? obj : atomDeserializer.getContainer(start, obj));
+ return atomDeserializer.<T, V>read(input, reference);
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
- protected <T, V extends T> Container<T> atom(final InputStream input, final Class<V> reference) {
+ @SuppressWarnings("unchecked")
+ protected <T, V extends T> Container<T> xml(final InputStream input, final Class<V> reference) {
try {
- return atomDeserializer.<T, V>read(input, reference);
+ final T obj = getXmlMapper().readValue(input, new TypeReference<V>() {
+ @Override
+ public Type getType() {
+ return reference;
+ }
+ });
+
+ return obj instanceof Container ? (Container<T>) obj : new Container<T>(null, null, obj);
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
+ @SuppressWarnings("unchecked")
protected <T, V extends T> Container<T> json(final InputStream input, final Class<V> reference) {
try {
- T obj = getObjectMapper().readValue(input, new TypeReference<V>() {
+ final T obj = getObjectMapper().readValue(input, new TypeReference<V>() {
@Override
public Type getType() {
return reference;
[42/51] [abbrv] git commit: Updating Tomcat version
Posted by sk...@apache.org.
Updating Tomcat version
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/6ae704d6
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/6ae704d6
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/6ae704d6
Branch: refs/heads/olingo-206-validator
Commit: 6ae704d62f364d91966c91b92254a536f8213c27
Parents: 242f782
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Apr 2 15:29:16 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Apr 2 15:29:16 2014 +0200
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6ae704d6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3db438d..953c4f4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
<cargo.rmi.port>9805</cargo.rmi.port>
<cargo.log>${log.directory}/cargo.log</cargo.log>
<cargo.output>${log.directory}/cargo-output.log</cargo.output>
- <tomcat.version>7.0.52</tomcat.version>
+ <tomcat.version>7.0.53</tomcat.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
[07/51] [abbrv] [OLINGO-200] Introducing specialization for V3 and V4
domain objects
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
index 69f6f2a..a32a153 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
@@ -18,10 +18,20 @@
*/
package org.apache.olingo.client.core.communication.request.retrieve.v4;
+import java.net.URI;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
-import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
+import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
implements RetrieveRequestFactory {
@@ -37,4 +47,22 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
return new XMLMetadataRequestImpl(((ODataClient) client),
client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI query) {
+ return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
+ return new ODataEntityRequestImpl<ODataEntity>(client, query);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI query) {
+ return new ODataPropertyRequestImpl<ODataProperty>(client, query);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
index f7e5ffa..2c1dd22 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
@@ -98,7 +98,7 @@ public class ODataMediaEntityCreateRequestImpl
private class ODataMediaEntityCreateResponseImpl extends AbstractODataResponse
implements ODataMediaEntityCreateResponse {
- private ODataEntity entity = null;
+ private CommonODataEntity entity = null;
/**
* Constructor.
@@ -122,7 +122,7 @@ public class ODataMediaEntityCreateRequestImpl
* {@inheritDoc }
*/
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
if (entity == null) {
try {
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
index a22843f..614baa1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
@@ -101,7 +101,7 @@ public class ODataMediaEntityUpdateRequestImpl
private class ODataMediaEntityUpdateResponseImpl extends AbstractODataResponse
implements ODataMediaEntityUpdateResponse {
- private ODataEntity entity = null;
+ private CommonODataEntity entity = null;
/**
* Constructor.
@@ -125,7 +125,7 @@ public class ODataMediaEntityUpdateRequestImpl
* {@inheritDoc }
*/
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
if (entity == null) {
try {
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 2a0ea4f..4c86604 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -35,14 +35,13 @@ import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataOperation;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.core.domain.ODataPropertyImpl;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -89,7 +88,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
@Override
- public Feed getFeed(final ODataEntitySet entitySet, final Class<? extends Feed> reference) {
+ public Feed getFeed(final CommonODataEntitySet entitySet, final Class<? extends Feed> reference) {
final Feed feed = ResourceFactory.newFeed(reference);
feed.setCount(entitySet.getCount());
@@ -99,7 +98,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
feed.setNext(next);
}
- for (ODataEntity entity : entitySet.getEntities()) {
+ for (CommonODataEntity entity : entitySet.getEntities()) {
feed.getEntries().add(getEntry(entity, ResourceFactory.entryClassForFeed(reference)));
}
@@ -107,15 +106,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
@Override
- public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference) {
+ public Entry getEntry(final CommonODataEntity entity, final Class<? extends Entry> reference) {
return getEntry(entity, reference, true);
}
@Override
- public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
+ public Entry getEntry(final CommonODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
final Entry entry = ResourceFactory.newEntry(reference);
- entry.setId(entity.getReference());
entry.setType(entity.getName());
// -------------------------------------------------------------
@@ -176,7 +174,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
entry.setMediaContentType(entity.getMediaContentType());
}
- for (ODataProperty property : entity.getProperties()) {
+ for (CommonODataProperty property : entity.getProperties()) {
entry.getProperties().add(getProperty(property, reference, setType));
}
@@ -194,13 +192,13 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (link instanceof ODataInlineEntity) {
// append inline entity
- final ODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity();
LOG.debug("Append in-line entity\n{}", inlineEntity);
linkResource.setInlineEntry(getEntry(inlineEntity, ResourceFactory.entryClassForFormat(isXML)));
} else if (link instanceof ODataInlineEntitySet) {
// append inline feed
- final ODataEntitySet InlineFeed = ((ODataInlineEntitySet) link).getEntitySet();
+ final CommonODataEntitySet InlineFeed = ((ODataInlineEntitySet) link).getEntitySet();
LOG.debug("Append in-line feed\n{}", InlineFeed);
linkResource.setInlineFeed(getFeed(InlineFeed, ResourceFactory.feedClassForFormat(isXML)));
@@ -210,7 +208,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
@Override
- public Property getProperty(final ODataProperty property, final Class<? extends Entry> reference,
+ public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
final boolean setType) {
final Property propertyResource = ResourceFactory.newProperty(reference);
@@ -243,7 +241,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final ODataComplexValue _value = value.asComplex();
valueResource = new ComplexValueImpl();
- for (final Iterator<ODataProperty> itor = _value.iterator(); itor.hasNext();) {
+ for (final Iterator<CommonODataProperty> itor = _value.iterator(); itor.hasNext();) {
valueResource.asComplex().get().add(getProperty(itor.next(), reference, setType));
}
} else if (value.isCollection()) {
@@ -259,12 +257,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
@Override
- public ODataEntitySet getODataEntitySet(final Feed resource) {
+ public CommonODataEntitySet getODataEntitySet(final Feed resource) {
return getODataEntitySet(resource, null);
}
+ protected abstract boolean add(CommonODataEntitySet entitySet, CommonODataEntity entity);
+
@Override
- public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
+ public CommonODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
client.getSerializer().feed(resource, writer);
@@ -276,7 +276,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final URI next = resource.getNext();
- final ODataEntitySet entitySet = next == null
+ final CommonODataEntitySet entitySet = next == null
? client.getObjectFactory().newEntitySet()
: client.getObjectFactory().newEntitySet(URIUtils.getURI(base, next.toASCIIString()));
@@ -285,19 +285,19 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
for (Entry entryResource : resource.getEntries()) {
- entitySet.getEntities().add(getODataEntity(entryResource));
+ add(entitySet, getODataEntity(entryResource));
}
return entitySet;
}
@Override
- public ODataEntity getODataEntity(final Entry resource) {
+ public CommonODataEntity getODataEntity(final Entry resource) {
return getODataEntity(resource, null);
}
@Override
- public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
+ public CommonODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
client.getSerializer().entry(resource, writer);
@@ -307,13 +307,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
- final ODataEntity entity = resource.getSelfLink() == null
+ final CommonODataEntity entity = resource.getSelfLink() == null
? client.getObjectFactory().newEntity(resource.getType())
: client.getObjectFactory().newEntity(resource.getType(),
URIUtils.getURI(base, resource.getSelfLink().getHref()));
- entity.setReference(resource.getId());
-
if (StringUtils.isNotBlank(resource.getETag())) {
entity.setETag(resource.getETag());
}
@@ -362,18 +360,13 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
for (Property property : resource.getProperties()) {
- entity.getProperties().add(getODataProperty(property));
+ add(entity, getODataProperty(property));
}
return entity;
}
- @Override
- public ODataProperty getODataProperty(final Property property) {
- return new ODataPropertyImpl(property.getName(), getODataValue(property));
- }
-
- private ODataValue getODataValue(final Property resource) {
+ protected ODataValue getODataValue(final Property resource) {
ODataValue value = null;
if (resource.getValue().isPrimitive()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index f21f16a..4ff36f9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -25,11 +25,11 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
@@ -78,17 +78,17 @@ public abstract class AbstractODataReader implements CommonODataReader {
}
@Override
- public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
+ public CommonODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
}
@Override
- public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
+ public CommonODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
}
@Override
- public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
+ public CommonODataProperty readProperty(final InputStream input, final ODataFormat format) {
final Property property = client.getDeserializer().toProperty(input, format).getObject();
return client.getBinder().getODataProperty(property);
}
@@ -107,19 +107,19 @@ public abstract class AbstractODataReader implements CommonODataReader {
if (ODataEntitySetIterator.class.isAssignableFrom(reference)) {
res = new Container<T>(
null, null, (T) new ODataEntitySetIterator(client, src, ODataPubFormat.fromString(format)));
- } else if (ODataEntitySet.class.isAssignableFrom(reference)) {
+ } else if (CommonODataEntitySet.class.isAssignableFrom(reference)) {
final Container<Feed> container = client.getDeserializer().toFeed(src, ODataPubFormat.fromString(format));
res = new Container<T>(
container.getContextURL(),
container.getMetadataETag(),
(T) client.getBinder().getODataEntitySet(container.getObject()));
- } else if (ODataEntity.class.isAssignableFrom(reference)) {
+ } else if (CommonODataEntity.class.isAssignableFrom(reference)) {
final Container<Entry> container = client.getDeserializer().toEntry(src, ODataPubFormat.fromString(format));
res = new Container<T>(
container.getContextURL(),
container.getMetadataETag(),
(T) client.getBinder().getODataEntity(container.getObject()));
- } else if (ODataProperty.class.isAssignableFrom(reference)) {
+ } else if (CommonODataProperty.class.isAssignableFrom(reference)) {
final Container<Property> container = client.getDeserializer().toProperty(src, ODataFormat.fromString(format));
res = new Container<T>(
container.getContextURL(),
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
index 2b914b4..7ea9c99 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
@@ -26,9 +26,9 @@ import java.util.Collection;
import java.util.Collections;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.op.ODataWriter;
@@ -44,17 +44,17 @@ public class ODataWriterImpl implements ODataWriter {
}
@Override
- public InputStream writeEntities(final Collection<ODataEntity> entities, final ODataPubFormat format) {
+ public InputStream writeEntities(final Collection<CommonODataEntity> entities, final ODataPubFormat format) {
return writeEntities(entities, format, true);
}
@Override
public InputStream writeEntities(
- final Collection<ODataEntity> entities, final ODataPubFormat format, final boolean outputType) {
+ final Collection<CommonODataEntity> entities, final ODataPubFormat format, final boolean outputType) {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
- for (ODataEntity entity : entities) {
+ for (CommonODataEntity entity : entities) {
client.getSerializer().entry(client.getBinder().getEntry(
entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM), outputType), output);
}
@@ -66,17 +66,19 @@ public class ODataWriterImpl implements ODataWriter {
}
@Override
- public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format) {
+ public InputStream writeEntity(final CommonODataEntity entity, final ODataPubFormat format) {
return writeEntity(entity, format, true);
}
@Override
- public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format, final boolean outputType) {
- return writeEntities(Collections.<ODataEntity>singleton(entity), format, outputType);
+ public InputStream writeEntity(final CommonODataEntity entity, final ODataPubFormat format,
+ final boolean outputType) {
+
+ return writeEntities(Collections.<CommonODataEntity>singleton(entity), format, outputType);
}
@Override
- public InputStream writeProperty(final ODataProperty property, final ODataFormat format) {
+ public InputStream writeProperty(final CommonODataProperty property, final ODataFormat format) {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
client.getSerializer().property(client.getBinder().getProperty(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
index 3c5f5a4..28887dc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
@@ -18,11 +18,22 @@
*/
package org.apache.olingo.client.core.op.impl.v3;
+import java.net.URI;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.op.v3.ODataBinder;
import org.apache.olingo.client.core.op.AbstractODataBinder;
import org.apache.olingo.client.core.v3.ODataClientImpl;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.core.domain.v3.ODataPropertyImpl;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -33,6 +44,41 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ public boolean add(final CommonODataEntity entity, final CommonODataProperty property) {
+ return ((ODataEntity) entity).getProperties().add((ODataProperty) property);
+ }
+
+ @Override
+ protected boolean add(final CommonODataEntitySet entitySet, final CommonODataEntity entity) {
+ return ((ODataEntitySet) entitySet).getEntities().add((ODataEntity) entity);
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource) {
+ return (ODataEntitySet) super.getODataEntitySet(resource);
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
+ return (ODataEntitySet) super.getODataEntitySet(resource, defaultBaseURI);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource) {
+ return (ODataEntity) super.getODataEntity(resource);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
+ return (ODataEntity) super.getODataEntity(resource, defaultBaseURI);
+ }
+
+ @Override
+ public ODataProperty getODataProperty(final Property property) {
+ return new ODataPropertyImpl(property.getName(), getODataValue(property));
+ }
+
+ @Override
public ODataLinkCollection getLinkCollection(final LinkCollection linkCollection) {
final ODataLinkCollection collection = new ODataLinkCollection(linkCollection.getNext());
collection.setLinks(linkCollection.getLinks());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/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 9c81baf..0acc7d1 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
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.op.impl.v4;
+import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
@@ -25,6 +26,16 @@ import org.apache.olingo.client.api.op.v4.ODataBinder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataBinder;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -35,6 +46,16 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ public boolean add(final CommonODataEntity entity, final CommonODataProperty property) {
+ return ((ODataEntity) entity).getProperties().add((ODataProperty) property);
+ }
+
+ @Override
+ protected boolean add(final CommonODataEntitySet entitySet, final CommonODataEntity entity) {
+ return ((ODataEntitySet) entitySet).getEntities().add((ODataEntity) entity);
+ }
+
+ @Override
public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
@@ -56,4 +77,39 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
return serviceDocument;
}
+
+ @Override
+ public Entry getEntry(final CommonODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
+ final Entry entry = super.getEntry(entity, reference, setType);
+ entry.setId(((ODataEntity) entity).getReference());
+ return entry;
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource) {
+ return (ODataEntitySet) super.getODataEntitySet(resource);
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
+ return (ODataEntitySet) super.getODataEntitySet(resource, defaultBaseURI);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource) {
+ return (ODataEntity) super.getODataEntity(resource);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
+ final ODataEntity entity = (ODataEntity) super.getODataEntity(resource, defaultBaseURI);
+ entity.setReference(resource.getId());
+ return entity;
+ }
+
+ @Override
+ public ODataProperty getODataProperty(final Property property) {
+ return new ODataPropertyImpl(property.getName(), getODataValue(property));
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
index d6d5e36..f1b5d23 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
@@ -46,7 +46,9 @@ import org.apache.olingo.client.core.op.impl.v3.ODataReaderImpl;
import org.apache.olingo.client.core.op.impl.v3.ODataSerializerImpl;
import org.apache.olingo.client.core.uri.v3.URIBuilderImpl;
import org.apache.olingo.client.core.uri.v3.FilterFactoryImpl;
+import org.apache.olingo.commons.api.domain.v3.ODataObjectFactory;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.v3.ODataObjectFactoryImpl;
public class ODataClientImpl extends AbstractODataClient implements ODataClient {
@@ -64,6 +66,8 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
private final ODataBinder binder = new ODataBinderImpl(this);
+ private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
+
private final RetrieveRequestFactory retrieveReqFact = new RetrieveRequestFactoryImpl(this);
private final CUDRequestFactory cudReqFact = new CUDRequestFactoryImpl(this);
@@ -124,6 +128,11 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
}
@Override
+ public ODataObjectFactory getObjectFactory() {
+ return objectFactory;
+ }
+
+ @Override
public RetrieveRequestFactory getRetrieveRequestFactory() {
return retrieveReqFact;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
index a5aafab..d379bcf 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
@@ -46,7 +46,9 @@ import org.apache.olingo.client.core.op.impl.v4.ODataReaderImpl;
import org.apache.olingo.client.core.op.impl.v4.ODataSerializerImpl;
import org.apache.olingo.client.core.uri.v4.URIBuilderImpl;
import org.apache.olingo.client.core.uri.v4.FilterFactoryImpl;
+import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.v4.ODataObjectFactoryImpl;
public class ODataClientImpl extends AbstractODataClient implements ODataClient {
@@ -64,6 +66,8 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
private final ODataBinder binder = new ODataBinderImpl(this);
+ private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
+
private final RetrieveRequestFactory retrieveReqFact = new RetrieveRequestFactoryImpl(this);
private final CUDRequestFactory cudReqFact = new CUDRequestFactoryImpl(this);
@@ -123,6 +127,11 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
}
@Override
+ public ODataObjectFactory getObjectFactory() {
+ return objectFactory;
+ }
+
+ @Override
public RetrieveRequestFactory getRetrieveRequestFactory() {
return retrieveReqFact;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index bba68de..0a3b53d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -54,12 +54,12 @@ import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
@@ -117,10 +117,10 @@ public abstract class AbstractTestITCase {
assertNotNull(foundActual);
if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
- final ODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
+ final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
assertNotNull(originalInline);
- final ODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
+ final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
assertNotNull(actualInline);
checkProperties(originalInline.getProperties(), actualInline.getProperties());
@@ -128,23 +128,25 @@ public abstract class AbstractTestITCase {
}
}
- protected void checkProperties(final Collection<ODataProperty> original, final Collection<ODataProperty> actual) {
+ protected void checkProperties(final Collection<? extends CommonODataProperty> original,
+ final Collection<? extends CommonODataProperty> actual) {
+
assertTrue(original.size() <= actual.size());
// re-organize actual properties into a Map<String, ODataProperty>
- final Map<String, ODataProperty> actualProps = new HashMap<String, ODataProperty>(actual.size());
+ final Map<String, CommonODataProperty> actualProps = new HashMap<String, CommonODataProperty>(actual.size());
- for (ODataProperty prop : actual) {
+ for (CommonODataProperty prop : actual) {
assertFalse(actualProps.containsKey(prop.getName()));
actualProps.put(prop.getName(), prop);
}
assertTrue(actual.size() <= actualProps.size());
- for (ODataProperty prop : original) {
+ for (CommonODataProperty prop : original) {
assertNotNull(prop);
if (actualProps.containsKey(prop.getName())) {
- final ODataProperty actualProp = actualProps.get(prop.getName());
+ final CommonODataProperty actualProp = actualProps.get(prop.getName());
assertNotNull(actualProp);
if (prop.getValue() != null && actualProp.getValue() != null) {
@@ -168,13 +170,13 @@ public abstract class AbstractTestITCase {
original.getClass().getSimpleName(), actual.getClass().getSimpleName());
if (original.isComplex()) {
- final List<ODataProperty> originalFileds = new ArrayList<ODataProperty>();
- for (ODataProperty prop : original.asComplex()) {
+ final List<CommonODataProperty> originalFileds = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : original.asComplex()) {
originalFileds.add(prop);
}
- final List<ODataProperty> actualFileds = new ArrayList<ODataProperty>();
- for (ODataProperty prop : (ODataComplexValue) actual) {
+ final List<CommonODataProperty> actualFileds = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : (ODataComplexValue) actual) {
actualFileds.add(prop);
}
@@ -207,39 +209,42 @@ public abstract class AbstractTestITCase {
}
}
- protected ODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
- final ODataEntity entity = getClient().getObjectFactory().newEntity(
+ protected CommonODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
+ final CommonODataEntity entity = getClient().getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
entity.setMediaEntity(true);
- entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).setType(
- EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("Information",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).
+ setType(EdmPrimitiveTypeKind.String).build()));
return entity;
}
- protected ODataEntity getSampleCustomerProfile(
+ protected CommonODataEntity getSampleCustomerProfile(
final int id, final String sampleName, final boolean withInlineInfo) {
- final ODataEntity entity =
+ final CommonODataEntity entity =
getClient().getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
// add name attribute
- entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).setType(
- EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("Name",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).
+ setType(EdmPrimitiveTypeKind.String).build()));
// add key attribute
- entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
- EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
// add BackupContactInfo attribute (collection)
final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
- entity.getProperties().add(getClient().getObjectFactory().newCollectionProperty("BackupContactInfo",
- backupContactInfoValue));
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
// add BackupContactInfo.ContactDetails attribute (complex)
final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
@@ -302,7 +307,7 @@ public abstract class AbstractTestITCase {
}
}
- protected void debugODataProperty(final ODataProperty property, final String message) {
+ protected void debugODataProperty(final CommonODataProperty property, final String message) {
LOG.debug(message + "\n{}", property.toString());
}
@@ -310,7 +315,7 @@ public abstract class AbstractTestITCase {
LOG.debug(message + "\n{}", value.toString());
}
- protected void debugODataEntity(final ODataEntity entity, final String message) {
+ protected void debugODataEntity(final CommonODataEntity entity, final String message) {
if (LOG.isDebugEnabled()) {
StringWriter writer = new StringWriter();
getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, AtomEntryImpl.class), writer);
@@ -337,7 +342,7 @@ public abstract class AbstractTestITCase {
}
protected String getETag(final URI uri) {
- final ODataRetrieveResponse<ODataEntity> res = getClient().getRetrieveRequestFactory().
+ final ODataRetrieveResponse<CommonODataEntity> res = getClient().getRetrieveRequestFactory().
getEntityRequest(uri).execute();
try {
return res.getEtag();
@@ -346,12 +351,13 @@ public abstract class AbstractTestITCase {
}
}
- protected ODataEntity read(final ODataPubFormat format, final URI editLink) {
- final ODataEntityRequest req = getClient().getRetrieveRequestFactory().getEntityRequest(editLink);
+ protected CommonODataEntity read(final ODataPubFormat format, final URI editLink) {
+ final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().
+ getEntityRequest(editLink);
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
@@ -362,10 +368,10 @@ public abstract class AbstractTestITCase {
return entity;
}
- protected ODataEntity createEntity(
+ protected CommonODataEntity createEntity(
final String serviceRootURL,
final ODataPubFormat format,
- final ODataEntity original,
+ final CommonODataEntity original,
final String entitySetName) {
final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
@@ -381,7 +387,7 @@ public abstract class AbstractTestITCase {
assertEquals(201, createRes.getStatusCode());
assertEquals("Created", createRes.getStatusMessage());
- final ODataEntity created = createRes.getBody();
+ final CommonODataEntity created = createRes.getBody();
assertNotNull(created);
debugODataEntity(created, "Just created");
@@ -389,9 +395,9 @@ public abstract class AbstractTestITCase {
return created;
}
- protected ODataEntity compareEntities(final String serviceRootURL,
+ protected CommonODataEntity compareEntities(final String serviceRootURL,
final ODataPubFormat format,
- final ODataEntity original,
+ final CommonODataEntity original,
final int actualObjectId,
final Collection<String> expands) {
@@ -405,13 +411,14 @@ public abstract class AbstractTestITCase {
}
}
- final ODataEntityRequest req = getClient().getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
+ final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntity actual = res.getBody();
+ final CommonODataEntity actual = res.getBody();
assertNotNull(actual);
// check defined links
@@ -427,7 +434,7 @@ public abstract class AbstractTestITCase {
protected void cleanAfterCreate(
final ODataPubFormat format,
- final ODataEntity created,
+ final CommonODataEntity created,
final boolean includeInline,
final String baseUri) {
@@ -437,15 +444,15 @@ public abstract class AbstractTestITCase {
if (includeInline) {
for (ODataLink link : created.getNavigationLinks()) {
if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
if (inline.getEditLink() != null) {
toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
}
}
if (link instanceof ODataInlineEntitySet) {
- final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
- for (ODataEntity entity : inline.getEntities()) {
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ for (CommonODataEntity entity : inline.getEntities()) {
if (entity.getEditLink() != null) {
toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
}
@@ -465,7 +472,8 @@ public abstract class AbstractTestITCase {
deleteRes.close();
- final ODataEntityRequest retrieveReq = getClient().getRetrieveRequestFactory().getEntityRequest(link);
+ final ODataEntityRequest<CommonODataEntity> retrieveReq = getClient().getRetrieveRequestFactory().
+ getEntityRequest(link);
// bug that needs to be fixed on the SampleService - cannot get entity not found with header
// Accept: application/json;odata=minimalmetadata
retrieveReq.setFormat(format == ODataPubFormat.JSON_FULL_METADATA ? ODataPubFormat.JSON : format);
@@ -483,25 +491,25 @@ public abstract class AbstractTestITCase {
}
protected void updateEntityDescription(
- final ODataPubFormat format, final ODataEntity changes, final UpdateType type) {
+ final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type) {
updateEntityDescription(format, changes, type, null);
}
protected void updateEntityDescription(
- final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+ final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type, final String etag) {
updateEntityStringProperty("Description", format, changes, type, etag);
}
protected void updateEntityStringProperty(final String propertyName,
- final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+ final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type, final String etag) {
final URI editLink = changes.getEditLink();
final String newm = "New " + propertyName + "(" + System.currentTimeMillis() + ")";
- ODataProperty propertyValue = changes.getProperty(propertyName);
+ CommonODataProperty propertyValue = changes.getProperty(propertyName);
final String oldm;
if (propertyValue == null) {
@@ -513,16 +521,17 @@ public abstract class AbstractTestITCase {
assertNotEquals(newm, oldm);
- changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty(propertyName,
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
+ getClient().getBinder().add(changes,
+ getClient().getObjectFactory().newPrimitiveProperty(propertyName,
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
update(type, changes, format, etag);
- final ODataEntity actual = read(format, editLink);
+ final CommonODataEntity actual = read(format, editLink);
propertyValue = null;
- for (ODataProperty prop : actual.getProperties()) {
+ for (CommonODataProperty prop : actual.getProperties()) {
if (prop.getName().equals(propertyName)) {
propertyValue = prop;
}
@@ -533,7 +542,7 @@ public abstract class AbstractTestITCase {
}
protected void update(
- final UpdateType type, final ODataEntity changes, final ODataPubFormat format, final String etag) {
+ final UpdateType type, final CommonODataEntity changes, final ODataPubFormat format, final String etag) {
final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory().getEntityUpdateRequest(type, changes);
if (getClient().getConfiguration().isUseXHTTPMethod()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index b77ebf8..01e0d7b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -19,25 +19,26 @@
package org.apache.olingo.client.core.it.v3;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import java.io.InputStream;
import java.net.URI;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.junit.Ignore;
import org.junit.Test;
@@ -68,14 +69,15 @@ public class AsyncTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntity> entityRes = client.getRetrieveRequestFactory().
getEntityRequest(uri).execute();
- final ODataEntity entity = entityRes.getBody();
+ final CommonODataEntity entity = entityRes.getBody();
entity.getAssociationLinks().clear();
entity.getNavigationLinks().clear();
entity.getEditMediaLinks().clear();
entity.getProperties().remove(entity.getProperty("Description"));
- entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Description",
- client.getObjectFactory().newPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
+ getClient().getBinder().add(entity,
+ client.getObjectFactory().newPrimitiveProperty("Description",
+ client.getObjectFactory().newPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
final ODataEntityUpdateRequest updateReq =
client.getCUDRequestFactory().getEntityUpdateRequest(uri, UpdateType.MERGE, entity);
@@ -116,7 +118,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
assertEquals(201, createRes.getStatusCode());
- final ODataEntity created = createRes.getBody();
+ final CommonODataEntity created = createRes.getBody();
assertNotNull(created);
assertEquals(2, created.getProperties().size());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 1ebe190..bd1419f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
@@ -39,17 +34,24 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.junit.Ignore;
import org.junit.Test;
@@ -66,10 +68,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 1;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
+ final CommonODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -78,10 +80,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 2;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
+ final CommonODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -90,10 +92,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithInlineAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 3;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual =
+ final CommonODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
cleanAfterCreate(format, actual, true, getServiceRoot());
@@ -104,10 +106,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 4;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual =
+ final CommonODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
cleanAfterCreate(format, actual, true, getServiceRoot());
@@ -117,13 +119,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createInlineWithoutLinkAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 5;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
original.addLink(client.getObjectFactory().newInlineEntity(
"Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual =
+ final CommonODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
boolean found = false;
@@ -144,13 +146,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createInlineWithoutLinkAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 6;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
original.addLink(client.getObjectFactory().newInlineEntity(
"Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual =
+ final CommonODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
boolean found = false;
@@ -170,7 +172,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createWithNavigationAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity actual = createWithNavigationLink(format, 5);
+ final CommonODataEntity actual = createWithNavigationLink(format, 5);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -178,14 +180,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithNavigationAsJSON() {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity actual = createWithNavigationLink(format, 6);
+ final CommonODataEntity actual = createWithNavigationLink(format, 6);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
public void createWithFeedNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity actual = createWithFeedNavigationLink(format, 7);
+ final CommonODataEntity actual = createWithFeedNavigationLink(format, 7);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -193,14 +195,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithFeedNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity actual = createWithFeedNavigationLink(format, 8);
+ final CommonODataEntity actual = createWithFeedNavigationLink(format, 8);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
public void createWithBackNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity actual = createWithBackNavigationLink(format, 9);
+ final CommonODataEntity actual = createWithBackNavigationLink(format, 9);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@@ -208,7 +210,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithBackNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity actual = createWithBackNavigationLink(format, 10);
+ final CommonODataEntity actual = createWithBackNavigationLink(format, 10);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@@ -225,7 +227,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createReturnNoContent() {
final int id = 1;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").build(), original);
@@ -253,7 +255,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Ignore
public void issue135() {
final int id = 2;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer for issue 135", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer for issue 135", false);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer");
final ODataEntityCreateRequest createReq =
@@ -276,26 +278,28 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
}
- private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
+ private CommonODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
throws EdmPrimitiveTypeException {
final String sampleName = "Sample customer";
- final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, sampleName, false);
final Set<Integer> keys = new HashSet<Integer>();
keys.add(-100);
keys.add(-101);
for (Integer key : keys) {
- final ODataEntity order =
+ final CommonODataEntity order =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
- order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
- .build()));
- order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
- .build()));
+ getClient().getBinder().add(order,
+ client.getObjectFactory().newPrimitiveProperty("OrderId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(order,
+ client.getObjectFactory().newPrimitiveProperty("CustomerId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order);
@@ -306,24 +310,25 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
createReq.execute().getBody().getEditLink()));
}
- final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
+ final CommonODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
// now, compare the created one with the actual one and go deeply into the associated customer info.....
- final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
+ final CommonODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntitySet entitySet = res.getBody();
+ final CommonODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
assertEquals(2, entitySet.getCount());
- for (ODataEntity entity : entitySet.getEntities()) {
+ for (CommonODataEntity entity : entitySet.getEntities()) {
final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(keys.contains(key));
@@ -340,32 +345,32 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private ODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
+ private CommonODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
final String sampleName = "Sample customer";
- final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, sampleName, false);
original.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info", URI.create(getServiceRoot() + "/CustomerInfo(12)")));
- final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
+ final CommonODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
// now, compare the created one with the actual one and go deeply into the associated customer info.....
- final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
+ final CommonODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntity info = res.getBody();
+ final CommonODataEntity info = res.getBody();
assertNotNull(info);
boolean found = false;
- for (ODataProperty prop : info.getProperties()) {
+ for (CommonODataProperty prop : info.getProperties()) {
if ("CustomerInfoId".equals(prop.getName())) {
assertEquals("12", prop.getValue().toString());
found = true;
@@ -377,27 +382,29 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
+ private CommonODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
throws EdmPrimitiveTypeException {
final String sampleName = "Sample customer";
- ODataEntity customer = getSampleCustomerProfile(id, sampleName, false);
- customer = createEntity(getServiceRoot(), format, customer, "Customer");
+ ODataEntity customer = (ODataEntity) getSampleCustomerProfile(id, sampleName, false);
+ customer = (ODataEntity) createEntity(getServiceRoot(), format, customer, "Customer");
ODataEntity order = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
- order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
- setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(order,
+ client.getObjectFactory().newPrimitiveProperty("CustomerId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(order,
+ client.getObjectFactory().newPrimitiveProperty("OrderId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
order.addLink(client.getObjectFactory().newEntityNavigationLink(
"Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString())));
- order = createEntity(getServiceRoot(), format, order, "Order");
+ order = (ODataEntity) createEntity(getServiceRoot(), format, order, "Order");
ODataEntity changes = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
@@ -406,7 +413,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
"Orders", URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString())));
update(UpdateType.PATCH, changes, format, null);
- final ODataEntityRequest customerreq = client.getRetrieveRequestFactory().getEntityRequest(
+ final ODataEntityRequest<ODataEntity> customerreq = client.getRetrieveRequestFactory().getEntityRequest(
URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString() + "/Customer"));
customerreq.setFormat(format);
@@ -415,7 +422,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
assertEquals(Integer.valueOf(id),
customer.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class));
- final ODataEntitySetRequest orderreq = client.getRetrieveRequestFactory().getEntitySetRequest(
+ final ODataEntitySetRequest<ODataEntitySet> orderreq = client.getRetrieveRequestFactory().getEntitySetRequest(
URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "/Orders"));
orderreq.setFormat(format);
@@ -426,7 +433,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
orderres.getBody().getEntities().get(0).getProperty("OrderId").getPrimitiveValue().
toCastValue(Integer.class));
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(
URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "?$expand=Orders"));
req.setFormat(format);
@@ -444,27 +451,33 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
private void multiKey(final ODataPubFormat format) {
- final ODataEntity message = client.getObjectFactory().newEntity(
+ final CommonODataEntity message = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("MessageId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(1000).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FromUsername",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue("1").
- setType(EdmPrimitiveTypeKind.String).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("ToUsername",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
- setType(EdmPrimitiveTypeKind.String).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Subject",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test subject").
- setType(EdmPrimitiveTypeKind.String).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Body",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test body").
- setType(EdmPrimitiveTypeKind.String).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(false).
- setType(EdmPrimitiveTypeKind.Boolean).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("MessageId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(1000).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("FromUsername",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("1").
+ setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("ToUsername",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
+ setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("Subject",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test subject").
+ setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("Body",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test body").
+ setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("IsRead",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(false).
+ setType(EdmPrimitiveTypeKind.Boolean).build()));
final CommonURIBuilder<?> builder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index ddcd342..1b43c47 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@@ -30,16 +25,22 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.core.op.ResourceFactory;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
/**
@@ -55,7 +56,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Info");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -72,13 +73,13 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
for (ODataLink link : entity.getNavigationLinks()) {
if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
assertNotNull(inline);
debugEntry(client.getBinder().getEntry(
inline, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)), "Just read");
- final List<ODataProperty> properties = inline.getProperties();
+ final List<? extends CommonODataProperty> properties = inline.getProperties();
assertEquals(2, properties.size());
assertTrue(properties.get(0).getName().equals("CustomerInfoId")
@@ -108,7 +109,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Orders");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -119,7 +120,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
for (ODataLink link : entity.getNavigationLinks()) {
if (link instanceof ODataInlineEntitySet) {
- final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
assertNotNull(inline);
debugFeed(client.getBinder().getFeed(inline, ResourceFactory.feedClassForFormat(
@@ -153,10 +154,10 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final ODataRawResponse res = req.execute();
assertNotNull(res);
- final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+ final CommonODataEntitySet entitySet = res.getBodyAs(CommonODataEntitySet.class);
assertNull(entitySet);
- final ODataEntity entity = res.getBodyAs(ODataEntity.class);
+ final CommonODataEntity entity = res.getBodyAs(CommonODataEntity.class);
assertNotNull(entity);
}
@@ -179,7 +180,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Message").appendKeySegment(multiKey);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -212,7 +213,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Product").appendKeySegment(-10);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -221,7 +222,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final String etag = res.getEtag();
assertTrue(StringUtils.isNotBlank(etag));
- final ODataEntity product = res.getBody();
+ final CommonODataEntity product = res.getBody();
assertEquals(etag, product.getETag());
}
@@ -229,7 +230,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
public void issue99() {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.JSON);
// this statement should cause an IllegalArgumentException bearing JsonParseException
[48/51] [abbrv] git commit: [OLINGO-175] removed parent's license
dependency
Posted by sk...@apache.org.
[OLINGO-175] removed parent's license dependency
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/8888b051
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/8888b051
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/8888b051
Branch: refs/heads/olingo-206-validator
Commit: 8888b051bb4844e20e93ad1ed9fc19adaa53b5be
Parents: 809519f
Author: fmartelli <fa...@gmail.com>
Authored: Thu Apr 3 10:58:06 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Apr 3 10:58:06 2014 +0200
----------------------------------------------------------------------
fit/pom.xml | 18 ------------------
1 file changed, 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8888b051/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index b0c1d0a..6e53597 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -100,23 +100,12 @@
<version>${war.maven.plugin.version}</version>
<configuration>
<webResources>
- <!--
- HACK: Include legal files explicity, otherwise they will end up in the wrong path
- or in another jar file in the war.
- -->
<resource>
<directory>${project.build.outputDirectory}</directory>
<includes>
<include>META-INF/DEPENDENCIES*</include>
</includes>
</resource>
- <resource>
- <directory>${basedir}/../</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>LICENSE</include>
- </includes>
- </resource>
</webResources>
<packagingExcludes>WEB-INF/classes/esigate.properties,WEB-INF/classes/META-INF/LICENSE*,WEB-INF/classes/META-INF/DEPENDENCIES*</packagingExcludes>
</configuration>
@@ -163,13 +152,6 @@
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
- <resource>
- <directory>..</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>LICENSE</include>
- </includes>
- </resource>
</resources>
</build>
</project>
[12/51] [abbrv] git commit: [OLINGO-200] More V4 Enum tests
Posted by sk...@apache.org.
[OLINGO-200] More V4 Enum tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/117cf6f0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/117cf6f0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/117cf6f0
Branch: refs/heads/olingo-206-validator
Commit: 117cf6f0d0099ef5d553e2a46b359d0e38222996
Parents: cd7ede0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sun Mar 30 16:12:17 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sun Mar 30 16:12:17 2014 +0200
----------------------------------------------------------------------
.../retrieve/CommonRetrieveRequestFactory.java | 12 +-
.../retrieve/v3/RetrieveRequestFactory.java | 2 +-
.../AbstractRetrieveRequestFactory.java | 8 +-
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 19 ++-
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 19 ++-
.../client/core/op/AbstractODataBinder.java | 35 +++--
.../client/core/op/impl/v4/ODataBinderImpl.java | 45 +++++++
.../core/it/v3/EntityCreateTestITCase.java | 4 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 2 +-
.../olingo/client/core/v3/EntityTest.java | 5 +-
.../apache/olingo/client/core/v3/JSONTest.java | 4 +-
.../olingo/client/core/v4/EntityTest.java | 133 +++++++++++++++++++
.../api/domain/CommonODataObjectFactory.java | 4 +-
.../api/domain/v4/ODataObjectFactory.java | 2 +
.../core/domain/AbstractODataObjectFactory.java | 4 +-
.../core/domain/v4/ODataEnumValueImpl.java | 50 +++++++
.../core/domain/v4/ODataObjectFactoryImpl.java | 5 +
17 files changed, 298 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
index f8d48b3..69e53e7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
@@ -60,7 +60,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
/**
- * Gets a query request returning a set of one or more OData entities.
+ * Gets a uri request returning a set of one or more OData entities.
*
* @param <T> concrete ODataEntitySet implementation.
* @param uri request URI.
@@ -69,7 +69,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
<T extends CommonODataEntitySet> ODataEntitySetRequest<T> getEntitySetRequest(URI uri);
/**
- * Gets a query request returning a set of one or more OData entities.
+ * Gets a uri request returning a set of one or more OData entities.
* <br/>
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
* the entire entity set.
@@ -83,7 +83,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
ODataEntitySetIteratorRequest<ES, E> getEntitySetIteratorRequest(URI uri);
/**
- * Gets a query request returning a single OData entity.
+ * Gets a uri request returning a single OData entity.
*
* @param <T> concrete ODataEntity implementation.
* @param uri request URI.
@@ -92,7 +92,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
<T extends CommonODataEntity> ODataEntityRequest<T> getEntityRequest(URI uri);
/**
- * Gets a query request returning a single OData entity property.
+ * Gets a uri request returning a single OData entity property.
*
* @param <T> concrete ODataProperty implementation.
* @param uri request URI.
@@ -101,7 +101,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
<T extends CommonODataProperty> ODataPropertyRequest<T> getPropertyRequest(URI uri);
/**
- * Gets a query request returning a single OData entity property value.
+ * Gets a uri request returning a single OData entity property value.
*
* @param uri request URI.
* @return new {@link ODataValueRequest} instance.
@@ -109,7 +109,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
ODataValueRequest getValueRequest(URI uri);
/**
- * Gets a query request returning a media stream.
+ * Gets a uri request returning a media stream.
*
* @param uri request URI.
* @return new {@link ODataMediaRequest} instance.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
index 00568bd..0d133cb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
@@ -47,7 +47,7 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
/**
- * Gets a query request returning a single OData link.
+ * Gets a uri request returning a single OData link.
*
* @param targetURI target URI.
* @param linkName link name.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
index a801953..d5e0319 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
@@ -39,13 +39,13 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe
}
@Override
- public ODataValueRequest getValueRequest(final URI query) {
- return new ODataValueRequestImpl(client, query);
+ public ODataValueRequest getValueRequest(final URI uri) {
+ return new ODataValueRequestImpl(client, uri);
}
@Override
- public ODataMediaRequest getMediaRequest(final URI query) {
- return new ODataMediaRequestImpl(client, query);
+ public ODataMediaRequest getMediaRequest(final URI uri) {
+ return new ODataMediaRequestImpl(client, uri);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
index 3943747..0e8db34 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
@@ -36,6 +36,7 @@ import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+@SuppressWarnings("unchecked")
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
implements RetrieveRequestFactory {
@@ -56,27 +57,23 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
return new ODataLinkCollectionRequestImpl((ODataClient) client, targetURI, linkName);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI query) {
- return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
+ public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI uri) {
+ return new ODataEntitySetRequestImpl<ODataEntitySet>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
+ public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(final URI uri) {
return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
- return new ODataEntityRequestImpl<ODataEntity>(client, query);
+ public ODataEntityRequest<ODataEntity> getEntityRequest(final URI uri) {
+ return new ODataEntityRequestImpl<ODataEntity>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI query) {
- return new ODataPropertyRequestImpl<ODataProperty>(client, query);
+ public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI uri) {
+ return new ODataPropertyRequestImpl<ODataProperty>(client, uri);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
index 96419c2..879417b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
@@ -35,6 +35,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+@SuppressWarnings("unchecked")
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
implements RetrieveRequestFactory {
@@ -50,27 +51,23 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI query) {
- return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
+ public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI uri) {
+ return new ODataEntitySetRequestImpl<ODataEntitySet>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
+ public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(final URI uri) {
return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
- return new ODataEntityRequestImpl<ODataEntity>(client, query);
+ public ODataEntityRequest<ODataEntity> getEntityRequest(final URI uri) {
+ return new ODataEntityRequestImpl<ODataEntity>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI query) {
- return new ODataPropertyRequestImpl<ODataProperty>(client, query);
+ public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI uri) {
+ return new ODataPropertyRequestImpl<ODataProperty>(client, uri);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 4c86604..13a49fb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -42,6 +42,7 @@ import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -54,6 +55,7 @@ import org.apache.olingo.commons.core.data.JSONPropertyImpl;
import org.apache.olingo.commons.core.data.LinkImpl;
import org.apache.olingo.commons.core.data.NullValueImpl;
import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -228,7 +230,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
return propertyResource;
}
- private Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
+ protected Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
Value valueResource = null;
if (value == null) {
@@ -329,8 +331,12 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final Feed inlineFeed = link.getInlineFeed();
if (inlineEntry == null && inlineFeed == null) {
- entity.addLink(
- client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref()));
+ final ODataLinkType linkType = link.getType() == null
+ ? ODataLinkType.ENTITY_NAVIGATION
+ : ODataLinkType.fromString(client.getServiceVersion(), link.getRel(), link.getType());
+ entity.addLink(linkType == ODataLinkType.ENTITY_NAVIGATION
+ ? client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref())
+ : client.getObjectFactory().newEntitySetNavigationLink(link.getTitle(), base, link.getHref()));
} else if (inlineEntry != null) {
entity.addLink(client.getObjectFactory().newInlineEntity(
link.getTitle(), base, link.getHref(),
@@ -369,28 +375,35 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
protected ODataValue getODataValue(final Property resource) {
ODataValue value = null;
+ final EdmTypeInfo typeInfo = resource.getType() == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(resource.getType()).build();
if (resource.getValue().isPrimitive()) {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setText(resource.getValue().asPrimitive().get()).
- setType(resource.getType() == null
+ setType(typeInfo == null
? null
- : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isGeospatial()) {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setValue(resource.getValue().asGeospatial().get()).
- setType(resource.getType() == null
- || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
- || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
+ setType(typeInfo == null
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
- : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isComplex()) {
- value = client.getObjectFactory().newComplexValue(resource.getType());
+ value = client.getObjectFactory().newComplexValue(typeInfo == null
+ ? null : typeInfo.getFullQualifiedName().toString());
for (Property property : resource.getValue().asComplex().get()) {
value.asComplex().add(getODataProperty(property));
}
} else if (resource.getValue().isCollection()) {
- value = client.getObjectFactory().newCollectionValue(resource.getType());
+ value = client.getObjectFactory().newCollectionValue(typeInfo == null
+ ? null : "Collection(" + typeInfo.getFullQualifiedName().toString() + ")");
for (Value _value : resource.getValue().asCollection().get()) {
final JSONPropertyImpl fake = new JSONPropertyImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/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 0acc7d1..e85b34e 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
@@ -29,13 +29,17 @@ import org.apache.olingo.client.core.op.AbstractODataBinder;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.core.data.EnumValueImpl;
import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -86,6 +90,31 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
+ final boolean setType) {
+
+ final Property propertyResource = super.getProperty(property, reference, setType);
+ if (property instanceof ODataProperty && ((ODataProperty) property).hasEnumValue() && setType) {
+ propertyResource.setType(((ODataProperty) property).getEnumValue().getTypeName());
+ }
+ return propertyResource;
+ }
+
+ @Override
+ protected Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
+ Value valueResource;
+ if (value instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
+ && ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).isEnum()) {
+
+ valueResource = new EnumValueImpl(
+ ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).asEnum().getValue());
+ } else {
+ valueResource = super.getValue(value, reference, setType);
+ }
+ return valueResource;
+ }
+
+ @Override
public ODataEntitySet getODataEntitySet(final Feed resource) {
return (ODataEntitySet) super.getODataEntitySet(resource);
}
@@ -112,4 +141,20 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
return new ODataPropertyImpl(property.getName(), getODataValue(property));
}
+ @Override
+ protected ODataValue getODataValue(final Property resource) {
+ ODataValue value;
+ if (resource.getValue().isEnum()) {
+ final EdmTypeInfo typeInfo = resource.getType() == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(resource.getType()).build();
+ value = ((ODataClient) client).getObjectFactory().newEnumValue(
+ typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(),
+ resource.getValue().asEnum().get());
+ } else {
+ value = super.getODataValue(resource);
+ }
+
+ return value;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index bd1419f..2a4efee 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -305,7 +305,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order);
createReq.setFormat(format);
- original.addLink(client.getObjectFactory().newFeedNavigationLink(
+ original.addLink(client.getObjectFactory().newEntitySetNavigationLink(
"Orders",
createReq.execute().getBody().getEditLink()));
}
@@ -409,7 +409,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
ODataEntity changes = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
changes.setEditLink(customer.getEditLink());
- changes.addLink(client.getObjectFactory().newFeedNavigationLink(
+ changes.addLink(client.getObjectFactory().newEntitySetNavigationLink(
"Orders", URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString())));
update(UpdateType.PATCH, changes, format, null);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index fcbbe80..3b518d9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -223,7 +223,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
orderEntity);
createReq.setFormat(format);
createReq.setContentType(contentType);
- original.addLink(client.getObjectFactory().newFeedNavigationLink(
+ original.addLink(client.getObjectFactory().newEntitySetNavigationLink(
"Orders",
createReq.execute().getBody().getEditLink()));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index fe5b148..41da651 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -29,6 +29,7 @@ import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -45,7 +46,7 @@ public class EntityTest extends AbstractTest {
private void readAndWrite(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Customer_-10." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
@@ -64,7 +65,7 @@ public class EntityTest extends AbstractTest {
assertTrue(check);
- final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
index bae0bdd..522e686 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
@@ -1,5 +1,3 @@
-package org.apache.olingo.client.core.v3;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,8 @@ package org.apache.olingo.client.core.v3;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.olingo.client.core.v3;
+
import static org.junit.Assert.assertEquals;
import com.fasterxml.jackson.databind.JsonNode;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/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
new file mode 100644
index 0000000..f9c57c2
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -0,0 +1,133 @@
+/*
+ * 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.InputStream;
+import java.util.Iterator;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
+import org.apache.olingo.commons.core.op.ResourceFactory;
+import org.junit.Test;
+
+public class EntityTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private void singleton(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getName());
+
+ final ODataProperty birthday = entity.getProperty("Birthday");
+ assertTrue(birthday.hasPrimitiveValue());
+ assertEquals(EdmDateTimeOffset.getInstance(), birthday.getPrimitiveValue().getType());
+
+ final ODataProperty timeBetweenLastTwoOrders = entity.getProperty("TimeBetweenLastTwoOrders");
+ assertTrue(timeBetweenLastTwoOrders.hasPrimitiveValue());
+ assertEquals(EdmDuration.getInstance(), timeBetweenLastTwoOrders.getPrimitiveValue().getType());
+
+ int checked = 0;
+ for (ODataLink link : entity.getNavigationLinks()) {
+ if ("Parent".equals(link.getName())) {
+ checked++;
+ assertEquals(ODataLinkType.ENTITY_NAVIGATION, link.getType());
+ }
+ if ("Orders".equals(link.getName())) {
+ checked++;
+ if (format == ODataPubFormat.ATOM) {
+ assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, link.getType());
+ }
+ }
+ if ("Company".equals(link.getName())) {
+ checked++;
+ assertEquals(ODataLinkType.ENTITY_NAVIGATION, link.getType());
+ }
+ }
+ assertEquals(3, checked);
+
+ // operations won't get serialized
+ entity.getOperations().clear();
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomSingleton() {
+ singleton(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonSingleton() {
+ singleton(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ private void withEnums(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ final ODataProperty skinColor = entity.getProperty("SkinColor");
+ assertTrue(skinColor.hasEnumValue());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", skinColor.getEnumValue().getTypeName());
+ assertEquals("Red", skinColor.getEnumValue().getValue());
+
+// final ODataProperty coverColors = entity.getProperty("CoverColors");
+// assertTrue(coverColors.hasCollectionValue());
+// for (final Iterator<ODataValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
+// final ODataValue item = itor.next();
+// assertTrue(item.isEnum());
+// }
+
+ // operations won't get serialized
+ entity.getOperations().clear();
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomWithEnums() {
+ withEnums(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonWithEnums() {
+ withEnums(ODataPubFormat.JSON_FULL_METADATA);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
index 525dc9d..40ffda9 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
@@ -125,7 +125,7 @@ public interface CommonODataObjectFactory {
* @param link link.
* @return entity set navigation link.
*/
- ODataLink newFeedNavigationLink(String name, URI link);
+ ODataLink newEntitySetNavigationLink(String name, URI link);
/**
* Instantiates a new entity set navigation link.
@@ -135,7 +135,7 @@ public interface CommonODataObjectFactory {
* @param href href.
* @return entity set navigation link.
*/
- ODataLink newFeedNavigationLink(String name, URI baseURI, String href);
+ ODataLink newEntitySetNavigationLink(String name, URI baseURI, String href);
/**
* Instantiates a new association link.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
index 8b43bc1..d12f0dc 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
@@ -38,6 +38,8 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
@Override
ODataEntity newEntity(String name, URI link);
+ ODataEnumValue newEnumValue(String typeName, String value);
+
@Override
ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
index ea73910..a3133cd 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
@@ -80,13 +80,13 @@ public abstract class AbstractODataObjectFactory implements CommonODataObjectFac
}
@Override
- public ODataLink newFeedNavigationLink(final String name, final URI link) {
+ public ODataLink newEntitySetNavigationLink(final String name, final URI link) {
return new ODataLink.Builder().setVersion(version).setURI(link).
setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
}
@Override
- public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
+ public ODataLink newEntitySetNavigationLink(final String name, final URI baseURI, final String href) {
return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
new file mode 100644
index 0000000..ee21018
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+
+public class ODataEnumValueImpl extends AbstractODataValue implements ODataEnumValue {
+
+ private static final long serialVersionUID = 5830261159033325828L;
+
+ private final String value;
+
+ public ODataEnumValueImpl(final String typeName, final String value) {
+ super(typeName);
+ this.value = value;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public boolean isEnum() {
+ return true;
+ }
+
+ @Override
+ public ODataEnumValue asEnum() {
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
index 1b6428f..0a84407 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
@@ -59,6 +59,11 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
}
@Override
+ public ODataEnumValue newEnumValue(final String typeName, final String value) {
+ return new ODataEnumValueImpl(typeName, value);
+ }
+
+ @Override
public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
return new ODataPropertyImpl(name, value);
}
[18/51] [abbrv] git commit: [OLINGO-200] V3, V4 Error tests in
Posted by sk...@apache.org.
[OLINGO-200] V3, V4 Error tests in
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/de591bb5
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/de591bb5
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/de591bb5
Branch: refs/heads/olingo-206-validator
Commit: de591bb58303c185d0739ad5902732039916d97a
Parents: eeb5d9b
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 16:55:31 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 16:55:31 2014 +0200
----------------------------------------------------------------------
.../ODataClientErrorException.java | 31 +--
.../communication/request/ODataRequestImpl.java | 23 +-
.../client/core/it/v3/ErrorTestITCase.java | 1 -
.../apache/olingo/client/core/v3/ErrorTest.java | 6 +-
.../apache/olingo/client/core/v4/ErrorTest.java | 61 +++++
.../org/apache/olingo/client/core/v3/error.xml | 2 +-
.../org/apache/olingo/client/core/v4/error.json | 14 ++
.../org/apache/olingo/client/core/v4/error.xml | 31 +++
.../apache/olingo/commons/api/Constants.java | 7 +
.../olingo/commons/api/domain/ODataError.java | 28 +--
.../api/edm/constants/ODataServiceVersion.java | 3 +
.../commons/core/data/AbstractAtomDealer.java | 13 +
.../commons/core/data/AbstractODataError.java | 58 +++++
.../commons/core/data/AbstractProperty.java | 80 +++++++
.../commons/core/data/AbstractPropertyImpl.java | 80 -------
.../commons/core/data/AtomDeserializer.java | 60 ++++-
.../commons/core/data/AtomPropertyImpl.java | 2 +-
.../commons/core/data/JSONErrorBundle.java | 50 ----
.../olingo/commons/core/data/JSONErrorImpl.java | 237 -------------------
.../core/data/JSONODataErrorDeserializer.java | 60 +++++
.../commons/core/data/JSONODataErrorImpl.java | 26 ++
.../commons/core/data/JSONPropertyImpl.java | 2 +-
.../core/data/ODataJacksonDeserializer.java | 3 +
.../olingo/commons/core/data/XMLErrorImpl.java | 213 -----------------
.../commons/core/data/XMLODataErrorImpl.java | 23 ++
.../core/op/AbstractODataDeserializer.java | 16 +-
26 files changed, 465 insertions(+), 665 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
index 85ae888..6dc2f07 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.api.communication;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Collections;
-import java.util.List;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.StatusLine;
import org.apache.olingo.commons.api.domain.ODataError;
@@ -60,34 +55,10 @@ public class ODataClientErrorException extends RuntimeException {
*/
public ODataClientErrorException(final StatusLine statusLine, final ODataError error) {
super((StringUtils.isBlank(error.getCode()) ? StringUtils.EMPTY : "(" + error.getCode() + ") ")
- + error.getMessageValue() + " [" + statusLine.toString() + "]");
+ + error.getMessage() + " [" + statusLine.toString() + "]");
this.statusLine = statusLine;
this.error = error;
-
- if (this.error.getInnerErrorType() != null && this.error.getInnerErrorMessage() != null) {
- final RuntimeException cause =
- new RuntimeException(this.error.getInnerErrorType() + ": " + this.error.getInnerErrorMessage());
-
- if (this.error.getInnerErrorStacktrace() != null) {
- List<String> stLines;
- try {
- stLines = IOUtils.readLines(new StringReader(this.error.getInnerErrorStacktrace()));
- } catch (IOException e) {
- stLines = Collections.<String>emptyList();
- }
- StackTraceElement[] stElements = new StackTraceElement[stLines.size()];
- for (int i = 0; i < stLines.size(); i++) {
- final String stLine = stLines.get(i).substring(stLines.get(i).indexOf("at ") + 3);
- final int lastDotPos = stLine.lastIndexOf('.');
- stElements[i] = new StackTraceElement(
- stLine.substring(0, lastDotPos), stLine.substring(lastDotPos + 1), null, 0);
- }
- cause.setStackTrace(stElements);
- }
-
- initCause(cause);
- }
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index 65cca8d..12696a6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -24,7 +24,6 @@ import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.net.URI;
import java.util.Collection;
-import java.util.Collections;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
@@ -52,8 +51,8 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.commons.core.data.JSONErrorImpl;
-import org.apache.olingo.commons.core.data.XMLErrorImpl;
+import org.apache.olingo.commons.core.data.JSONODataErrorImpl;
+import org.apache.olingo.commons.core.data.XMLODataErrorImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -479,19 +478,13 @@ public class ODataRequestImpl<T extends Format> implements ODataRequest {
private ODataError getGenericError(final int code, final String errorMsg, final boolean isXML) {
final ODataError error;
if (isXML) {
- error = new XMLErrorImpl();
- final XMLErrorImpl.Message msg = new XMLErrorImpl.Message(
- Collections.singletonMap("", (Object) errorMsg));
-
- ((XMLErrorImpl) error).setMessage(msg);
- ((XMLErrorImpl) error).setCode(String.valueOf(code));
+ error = new XMLODataErrorImpl();
+ ((XMLODataErrorImpl) error).setCode(String.valueOf(code));
+ ((XMLODataErrorImpl) error).setMessage(errorMsg);
} else {
- error = new JSONErrorImpl();
- final JSONErrorImpl.Message msg = new JSONErrorImpl.Message();
- msg.setValue(errorMsg);
-
- ((JSONErrorImpl) error).setMessage(msg);
- ((JSONErrorImpl) error).setCode(String.valueOf(code));
+ error = new JSONODataErrorImpl();
+ ((JSONODataErrorImpl) error).setCode(String.valueOf(code));
+ ((JSONODataErrorImpl) error).setMessage(errorMsg);
}
return error;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index 04c41de..efb818b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -99,7 +99,6 @@ public class ErrorTestITCase extends AbstractTestITCase {
} catch (ODataClientErrorException e) {
LOG.error("ODataClientErrorException found", e);
assertEquals(400, e.getStatusLine().getStatusCode());
- assertNotNull(e.getCause());
assertNotNull(e.getODataError());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
index 0b10d51..b2cf8e3 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.olingo.client.core.v3;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.commons.api.domain.ODataError;
@@ -43,7 +43,7 @@ public class ErrorTest extends AbstractTest {
private void simple(final ODataPubFormat format) {
final ODataError error = error("error", format);
- assertNull(error.getInnerErrorStacktrace());
+ assertEquals("The URL representing the root of the service only supports GET requests.", error.getMessage());
}
@Test
@@ -58,7 +58,7 @@ public class ErrorTest extends AbstractTest {
private void stacktrace(final ODataPubFormat format) {
final ODataError error = error("stacktrace", format);
- assertNotNull(error.getInnerErrorStacktrace());
+ assertEquals("Unsupported media type requested.", error.getMessage());
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/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
new file mode 100644
index 0000000..c89fa39
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.v4.ODataClient;
+import org.apache.olingo.commons.api.domain.ODataError;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.client.core.AbstractTest;
+import org.junit.Test;
+
+public class ErrorTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private ODataError error(final String name, final ODataPubFormat format) {
+ final ODataError error = getClient().getDeserializer().toError(
+ getClass().getResourceAsStream(name + "." + getSuffix(format)), format == ODataPubFormat.ATOM);
+ assertNotNull(error);
+ return error;
+ }
+
+ private void simple(final ODataPubFormat format) {
+ final ODataError error = error("error", format);
+ assertEquals("501", error.getCode());
+ assertEquals("Unsupported functionality", error.getMessage());
+ assertEquals("query", error.getTarget());
+ }
+
+ @Test
+ public void jsonSimple() {
+ simple(ODataPubFormat.JSON);
+ }
+
+ @Test
+ public void atomSimple() {
+ simple(ODataPubFormat.ATOM);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
index 2ef78ad..9d999ff 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
@@ -21,5 +21,5 @@
-->
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code />
- <m:message xml:lang="en-US">The URI 'http://192.168.0.160:8080/DefaultService.svc/Customer(100)' is not valid for POST operation. For POST operations, the URI must refer to a service operation or an entity set.</m:message>
+ <m:message xml:lang="en-US">The URL representing the root of the service only supports GET requests.</m:message>
</m:error>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
new file mode 100644
index 0000000..30a50d8
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
@@ -0,0 +1,14 @@
+{
+ "error": {
+ "code": "501",
+ "message": "Unsupported functionality",
+ "target": "query",
+ "details": [
+ {
+ "code": "301",
+ "target": "$search",
+ "message": "$search query option not supported"
+ }
+ ]
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
new file mode 100644
index 0000000..149b799
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
+ <code>501</code>
+ <message>Unsupported functionality</message>
+ <target>query</target>
+ <details>
+ <detail>
+ <code>301</code>
+ <message>$search query option not supported</message>
+ <target>$search</target>
+ </detail>
+ </details>
+</error>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index f41c30c..a1aec31 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -224,4 +224,11 @@ public interface Constants {
public static final String ATOM_ATTR_METADATAETAG = "metadata-etag";
+ // error stuff
+ public static final String ERROR_CODE = "code";
+
+ public static final String ERROR_MESSAGE = "message";
+
+ public static final String ERROR_TARGET = "target";
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
index 2993964..fc309d3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
@@ -31,37 +31,17 @@ public interface ODataError {
String getCode();
/**
- * Gets error message language.
- *
- * @return error message language.
- */
- String getMessageLang();
-
- /**
* Gets error message.
*
* @return error message.
*/
- String getMessageValue();
-
- /**
- * Gets inner error message.
- *
- * @return inner error message.
- */
- String getInnerErrorMessage();
+ String getMessage();
/**
- * Gets inner error type.
+ * Gets error target.
*
- * @return inner error type.
+ * @return error message.
*/
- String getInnerErrorType();
+ String getTarget();
- /**
- * Gets inner error stack-trace.
- *
- * @return inner error stack-trace
- */
- String getInnerErrorStacktrace();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index 5442d1d..c6354ec 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -69,6 +69,7 @@ public enum ODataServiceVersion {
public static final String JSON_ASSOCIATION_LINK = "jsonAssociationLink";
public static final String JSON_NAVIGATION_LINK = "jsonNavigationLink";
+ public static final String JSON_ERROR = "jsonError";
private static final Map<String, String> V30_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
@@ -100,6 +101,7 @@ public enum ODataServiceVersion {
put(JSON_MEDIA_ETAG, "odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLinkUrl");
put(JSON_NAVIGATION_LINK, "@odata.navigationLinkUrl");
+ put(JSON_ERROR, "odata.error");
}
});
@@ -133,6 +135,7 @@ public enum ODataServiceVersion {
put(JSON_MEDIA_ETAG, "@odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLink");
put(JSON_NAVIGATION_LINK, "@odata.navigationLink");
+ put(JSON_ERROR, "error");
}
});
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index 656207c..e9338f1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -60,6 +60,12 @@ abstract class AbstractAtomDealer {
protected final QName v4PropertyValueQName;
+ protected final QName errorCodeQName;
+
+ protected final QName errorMessageQName;
+
+ protected final QName errorTargetQName;
+
public AbstractAtomDealer(final ODataServiceVersion version) {
this.version = version;
@@ -90,6 +96,13 @@ abstract class AbstractAtomDealer {
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ENTRY_REF);
this.v4PropertyValueQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.VALUE);
+
+ this.errorCodeQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_CODE);
+ this.errorMessageQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_MESSAGE);
+ this.errorTargetQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_TARGET);
}
protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
new file mode 100644
index 0000000..e5324d8
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
@@ -0,0 +1,58 @@
+/*
+ * 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.commons.core.data;
+
+import org.apache.olingo.commons.api.domain.ODataError;
+
+public abstract class AbstractODataError implements ODataError {
+
+ private String code;
+
+ private String message;
+
+ private String target;
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(final String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(final String message) {
+ this.message = message;
+ }
+
+ @Override
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(final String target) {
+ this.target = target;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
new file mode 100644
index 0000000..940bf89
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
@@ -0,0 +1,80 @@
+/*
+ * 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.commons.core.data;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
+
+public abstract class AbstractProperty implements Property {
+
+ private String name;
+
+ private String type;
+
+ private Value value;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public Value getValue() {
+ return value;
+ }
+
+ @Override
+ public void setValue(final Value value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
deleted file mode 100644
index e005f98..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
+++ /dev/null
@@ -1,80 +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.commons.core.data;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.Value;
-
-public abstract class AbstractPropertyImpl implements Property {
-
- private String name;
-
- private String type;
-
- private Value value;
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public String getType() {
- return type;
- }
-
- @Override
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public Value getValue() {
- return value;
- }
-
- @Override
- public void setValue(final Value value) {
- this.value = value;
- }
-
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
-
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- @Override
- public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index c2ffd8e..a786803 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -386,11 +386,69 @@ public class AtomDeserializer extends AbstractAtomDealer {
return getContainer(start, feed(reader, start));
}
+ private XMLODataErrorImpl error(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
+ final XMLODataErrorImpl error = new XMLODataErrorImpl();
+
+ boolean setCode = false;
+ boolean codeSet = false;
+ boolean setMessage = false;
+ boolean messageSet = false;
+ boolean setTarget = false;
+ boolean targetSet = false;
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (errorCodeQName.equals(event.asStartElement().getName())) {
+ setCode = true;
+ } else if (errorMessageQName.equals(event.asStartElement().getName())) {
+ setMessage = true;
+ } else if (errorTargetQName.equals(event.asStartElement().getName())) {
+ setTarget = true;
+ }
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ if (setCode && !codeSet) {
+ error.setCode(event.asCharacters().getData());
+ setCode = false;
+ codeSet = true;
+ }
+ if (setMessage && !messageSet) {
+ error.setMessage(event.asCharacters().getData());
+ setMessage = false;
+ messageSet = true;
+ }
+ if (setTarget && !targetSet) {
+ error.setTarget(event.asCharacters().getData());
+ setTarget = false;
+ targetSet = true;
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+
+ return error;
+ }
+
+ private Container<XMLODataErrorImpl> error(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, error(reader, start));
+ }
+
@SuppressWarnings("unchecked")
public <T, V extends T> Container<T> read(final InputStream input, final Class<V> reference)
throws XMLStreamException {
- if (AtomFeedImpl.class.equals(reference)) {
+ if (XMLODataErrorImpl.class.equals(reference)) {
+ return (Container<T>) error(input);
+ } else if (AtomFeedImpl.class.equals(reference)) {
return (Container<T>) feed(input);
} else if (AtomEntryImpl.class.equals(reference)) {
return (Container<T>) entry(input);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
index 9688db2..e0018bc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.commons.core.data;
-public class AtomPropertyImpl extends AbstractPropertyImpl {
+public class AtomPropertyImpl extends AbstractProperty {
private static final long serialVersionUID = 48748492242474814L;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
deleted file mode 100644
index 433b754..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
+++ /dev/null
@@ -1,50 +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.commons.core.data;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * This class represents a bundle for an OData error returned as JSON.
- */
-public class JSONErrorBundle extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -4784910226259754450L;
-
- @JsonProperty("odata.error")
- private JSONErrorImpl error;
-
- /**
- * Gets error.
- *
- * @return OData error object.
- */
- public JSONErrorImpl getError() {
- return error;
- }
-
- /**
- * Sets error.
- *
- * @param error OData error object.
- */
- public void setError(final JSONErrorImpl error) {
- this.error = error;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
deleted file mode 100644
index 4c6cb4a..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
+++ /dev/null
@@ -1,237 +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.commons.core.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class JSONErrorImpl extends AbstractPayloadObject implements ODataError {
-
- private static final long serialVersionUID = -3476499168507242932L;
-
- /**
- * Error message.
- */
- public static class Message extends AbstractPayloadObject {
-
- private static final long serialVersionUID = 2577818040815637859L;
-
- private String lang;
-
- private String value;
-
- /**
- * Gets language.
- *
- * @return language.
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Sets language.
- *
- * @param lang language.
- */
- public void setLang(final String lang) {
- this.lang = lang;
- }
-
- /**
- * Gets message.
- *
- * @return message.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets message.
- *
- * @param value message.
- */
- public void setValue(final String value) {
- this.value = value;
- }
- }
-
- /**
- * Inner error.
- */
- static class InnerError extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -3920947476143537640L;
-
- private String message;
-
- private String type;
-
- private String stacktrace;
-
- private InnerError internalexception;
-
- /**
- * Gets inner message.
- *
- * @return message.
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Sets inner message.
- *
- * @param message message.
- */
- public void setMessage(final String message) {
- this.message = message;
- }
-
- /**
- * Gets type.
- *
- * @return type.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets type.
- *
- * @param type type.
- */
- public void setType(final String type) {
- this.type = type;
- }
-
- /**
- * Gets stack-trace.
- *
- * @return stack-trace.
- */
- public String getStacktrace() {
- return stacktrace;
- }
-
- /**
- * Sets stack-trace.
- *
- * @param stacktrace stack-trace.
- */
- public void setStacktrace(final String stacktrace) {
- this.stacktrace = stacktrace;
- }
-
- public InnerError getInternalexception() {
- return internalexception;
- }
-
- public void setInternalexception(final InnerError internalexception) {
- this.internalexception = internalexception;
- }
- }
-
- private String code;
-
- @JsonProperty(value = "message")
- private Message message;
-
- @JsonProperty(value = "innererror", required = false)
- private InnerError innererror;
-
- /**
- * {@inheritDoc }
- */
- @Override
- public String getCode() {
- return code;
- }
-
- /**
- * Sets error code.
- *
- * @param code error code.
- */
- public void setCode(final String code) {
- this.code = code;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getMessageLang() {
- return this.message == null ? null : this.message.getLang();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getMessageValue() {
- return this.message == null ? null : this.message.getValue();
- }
-
- /**
- * Sets the value of the message property.
- *
- * @param value allowed object is {@link Error.Message }
- *
- */
- public void setMessage(final Message value) {
- this.message = value;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorMessage() {
- return this.innererror == null ? null : this.innererror.getMessage();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorType() {
- return this.innererror == null ? null : this.innererror.getType();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorStacktrace() {
- return this.innererror == null ? null : this.innererror.getStacktrace();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
new file mode 100644
index 0000000..f033de1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
@@ -0,0 +1,60 @@
+/*
+ * 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.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import org.apache.olingo.commons.api.Constants;
+
+public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODataErrorImpl> {
+
+ @Override
+ protected JSONODataErrorImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final JSONODataErrorImpl error = new JSONODataErrorImpl();
+
+ final ObjectNode tree = parser.getCodec().readTree(parser);
+ if (tree.has(jsonError)) {
+ final JsonNode errorNode = tree.get(jsonError);
+
+ if (errorNode.has(Constants.ERROR_CODE)) {
+ error.setCode(errorNode.get(Constants.ERROR_CODE).textValue());
+ }
+ if (errorNode.has(Constants.ERROR_MESSAGE)) {
+ final JsonNode message = errorNode.get(Constants.ERROR_MESSAGE);
+ if (message.isValueNode()) {
+ error.setMessage(message.textValue());
+ } else if (message.isObject()) {
+ error.setMessage(message.get(Constants.VALUE).asText());
+ }
+ }
+ if (errorNode.has(Constants.ERROR_TARGET)) {
+ error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue());
+ }
+ }
+
+ return error;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
new file mode 100644
index 0000000..c455d2d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
@@ -0,0 +1,26 @@
+/*
+ * 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.commons.core.data;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = JSONODataErrorDeserializer.class)
+public class JSONODataErrorImpl extends AbstractODataError {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
index 1ef0294..1018666 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
*/
@JsonSerialize(using = JSONPropertySerializer.class)
@JsonDeserialize(using = JSONPropertyDeserializer.class)
-public class JSONPropertyImpl extends AbstractPropertyImpl {
+public class JSONPropertyImpl extends AbstractProperty {
private static final long serialVersionUID = 553414431536637434L;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
index fa6e38f..7b05248 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
@@ -52,6 +52,8 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
protected String jsonNavigationLink;
+ protected String jsonError;
+
protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException;
@@ -76,6 +78,7 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
jsonMediaETag = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG);
jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK);
jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK);
+ jsonError = version.getJSONMap().get(ODataServiceVersion.JSON_ERROR);
return doDeserialize(jp, ctxt);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
deleted file mode 100644
index a8c3d84..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
+++ /dev/null
@@ -1,213 +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.commons.core.data;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
-import java.util.Map;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class XMLErrorImpl extends AbstractPayloadObject implements ODataError {
-
- private static final long serialVersionUID = -3476499168507242932L;
-
- @JacksonXmlText(false)
- private String code;
-
- @JsonProperty
- private Message message;
-
- @JsonProperty(required = false)
- private InnerError innererror;
-
- @Override
- public String getCode() {
- return code;
- }
-
- /**
- * Sets error code.
- *
- * @param code error code.
- */
- public void setCode(final String code) {
- this.code = code;
- }
-
- @JsonIgnore
- @Override
- public String getMessageLang() {
- return this.message == null ? null : this.message.getLang();
- }
-
- @JsonIgnore
- @Override
- public String getMessageValue() {
- return this.message == null ? null : this.message.getValue();
- }
-
- /**
- * Sets the value of the message property.
- *
- * @param value allowed object is {@link Error.Message }
- *
- */
- public void setMessage(final Message value) {
- this.message = value;
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorMessage() {
- return this.innererror == null ? null : this.innererror.getMessage().getValue();
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorType() {
- return this.innererror == null ? null : this.innererror.getType().getValue();
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorStacktrace() {
- return this.innererror == null ? null : this.innererror.getStacktrace().getValue();
- }
-
- static class TextChildContainer extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -8908394095210115904L;
-
- public TextChildContainer() {
- super();
- }
-
- public TextChildContainer(final String value) {
- super();
- this.value = value;
- }
-
- @JsonCreator
- public TextChildContainer(final Map<String, Object> props) {
- super();
- this.value = (String) props.get("");
- }
-
- private String value;
-
- public String getValue() {
- return value;
- }
-
- public void setValue(final String value) {
- this.value = value;
- }
- }
-
- /**
- * Error message.
- */
- public static class Message extends TextChildContainer {
-
- private static final long serialVersionUID = 2577818040815637859L;
-
- private String lang;
-
- public Message() {
- super();
- }
-
- @JsonCreator
- public Message(final Map<String, Object> props) {
- super(props);
- this.lang = (String) props.get("lang");
- }
-
- /**
- * Gets language.
- *
- * @return language.
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Sets language.
- *
- * @param lang language.
- */
- public void setLang(final String lang) {
- this.lang = lang;
- }
- }
-
- /**
- * Inner error.
- */
- static class InnerError extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -3920947476143537640L;
-
- private TextChildContainer message;
-
- private TextChildContainer type;
-
- private TextChildContainer stacktrace;
-
- private InnerError internalexception;
-
- public TextChildContainer getMessage() {
- return message;
- }
-
- public void setMessage(final TextChildContainer message) {
- this.message = message;
- }
-
- public TextChildContainer getType() {
- return type;
- }
-
- public void setType(final TextChildContainer type) {
- this.type = type;
- }
-
- public TextChildContainer getStacktrace() {
- return stacktrace;
- }
-
- public void setStacktrace(final TextChildContainer stacktrace) {
- this.stacktrace = stacktrace;
- }
-
- public InnerError getInternalexception() {
- return internalexception;
- }
-
- public void setInternalexception(final InnerError internalexception) {
- this.internalexception = internalexception;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
new file mode 100644
index 0000000..36cb682
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
@@ -0,0 +1,23 @@
+/*
+ * 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.commons.core.data;
+
+public class XMLODataErrorImpl extends AbstractODataError {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index bf4bd57..616766b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -39,10 +39,10 @@ import org.apache.olingo.commons.core.data.AtomEntryImpl;
import org.apache.olingo.commons.core.data.AtomFeedImpl;
import org.apache.olingo.commons.core.data.AtomPropertyImpl;
import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.core.data.JSONErrorBundle;
import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONODataErrorImpl;
import org.apache.olingo.commons.core.data.JSONPropertyImpl;
-import org.apache.olingo.commons.core.data.XMLErrorImpl;
+import org.apache.olingo.commons.core.data.XMLODataErrorImpl;
public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
@@ -80,8 +80,8 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
@Override
public ODataError toError(final InputStream input, final boolean isXML) {
return isXML
- ? this.<ODataError, XMLErrorImpl>xml(input, XMLErrorImpl.class).getObject()
- : this.<JSONErrorBundle, JSONErrorBundle>json(input, JSONErrorBundle.class).getObject().getError();
+ ? this.<ODataError, XMLODataErrorImpl>atom(input, XMLODataErrorImpl.class).getObject()
+ : this.<ODataError, JSONODataErrorImpl>json(input, JSONODataErrorImpl.class).getObject();
}
/*
@@ -90,21 +90,21 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
@SuppressWarnings("unchecked")
protected <T, V extends T> Container<T> xml(final InputStream input, final Class<V> reference) {
try {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final XMLEventReader reader = AtomDeserializer.FACTORY.createXMLEventReader(input);
final StartElement start = atomDeserializer.skipBeforeFirstStartElement(reader);
- final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(bos);
+ final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(baos);
writer.add(start);
writer.add(reader);
writer.flush();
writer.close();
return (Container<T>) atomDeserializer.getContainer(
- start, getXmlMapper().readValue(new ByteArrayInputStream(bos.toByteArray()), reference));
-
+ start, getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference));
} catch (Exception e) {
+ e.printStackTrace();
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
[24/51] [abbrv] git commit: [OLINGO-200] Fixing minor quirk in V4 APIs
Posted by sk...@apache.org.
[OLINGO-200] Fixing minor quirk in V4 APIs
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a5b7b257
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a5b7b257
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a5b7b257
Branch: refs/heads/olingo-206-validator
Commit: a5b7b2577d264efcac7af85a0c63c3d6ea56d728
Parents: 850d44e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 14:10:29 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 14:10:29 2014 +0200
----------------------------------------------------------------------
.../client/core/it/v4/EntityCreateTestITCase.java | 12 +++++-------
.../olingo/commons/api/domain/ODataCollectionValue.java | 2 +-
.../core/domain/AbstractODataCollectionValue.java | 5 +++--
3 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5b7b257/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
index 0044e73..962542c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
@@ -25,10 +25,9 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateR
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.core.domain.v3.ODataCollectionValueImpl;
import org.apache.olingo.commons.core.domain.v4.ODataEntityImpl;
import org.junit.Test;
@@ -52,15 +51,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000001S").build());
order.getProperties().add(shelfLife);
- // TODO: this should be possible via getClient().getObjectFactory().newCollectionValue()
- final ODataCollectionValue<ODataValue> orderShelfLifesValue =
- new ODataCollectionValueImpl("Collection(Duration)");
+ final ODataCollectionValue<ODataValue> orderShelfLifesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Duration)");
orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000001S").build());
orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build());
- final ODataProperty orderShelfLifes = getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
- orderShelfLifesValue);
+ final ODataProperty orderShelfLifes = getClient().getObjectFactory().
+ newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
order.getProperties().add(orderShelfLifes);
final ODataEntityCreateRequest<ODataEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5b7b257/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
index 29eedab..088bbc0 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
@@ -30,7 +30,7 @@ public interface ODataCollectionValue<OV extends ODataValue> extends ODataValue,
*
* @param value value to be added.
*/
- void add(OV value);
+ void add(ODataValue value);
/**
* Checks if collection is empty.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5b7b257/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
index 181f2da..2f8236b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
@@ -55,8 +55,9 @@ public abstract class AbstractODataCollectionValue<OV extends ODataValue>
* @param value value to be added.
*/
@Override
- public void add(final OV value) {
- values.add(value);
+ @SuppressWarnings("unchecked")
+ public void add(final ODataValue value) {
+ values.add((OV) value);
}
/**
[03/51] [abbrv] git commit: [OLINGO-175,
OLINGO-205] provided parameter aliases support
Posted by sk...@apache.org.
[OLINGO-175, OLINGO-205] provided parameter aliases support
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/4931b30b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/4931b30b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/4931b30b
Branch: refs/heads/olingo-206-validator
Commit: 4931b30b41354a66805bb1bc55f09e3c2cfb1cd4
Parents: e0d1b6f
Author: fmartelli <fa...@gmail.com>
Authored: Sat Mar 29 15:19:40 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Sat Mar 29 15:19:40 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/uri/CommonURIBuilder.java | 13 ++++--
.../client/core/uri/AbstractURIBuilder.java | 24 +++++++++-
.../olingo/client/core/uri/ParameterAlias.java | 48 ++++++++++++++++++++
.../apache/olingo/client/core/uri/URIUtils.java | 40 ++++++++--------
.../client/core/uri/v3/URIBuilderTest.java | 13 ++++++
5 files changed, 115 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
index 3f10262..6a8ce0e 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.api.uri;
-
import java.net.URI;
import java.util.Map;
@@ -41,11 +40,20 @@ public interface CommonURIBuilder<UB extends CommonURIBuilder<?>> {
*
* @param option query option.
* @param value query option value.
- * @return current URIBuilder instance
+ * @return current URIBuilder instance.
*/
UB addQueryOption(String option, String value);
/**
+ * Adds the specified (custom) parameter alias to the URI.
+ *
+ * @param alias parameter alias.
+ * @param exp expression value.
+ * @return current URIBuilder instance.
+ */
+ UB addParameterAlias(final String alias, final String exp);
+
+ /**
* Appends EntitySet segment to the URI.
*
* @param segmentValue segment value.
@@ -220,5 +228,4 @@ public interface CommonURIBuilder<UB extends CommonURIBuilder<?>> {
* @return OData URI.
*/
URI build();
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
index 906b62c..10feb7e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
@@ -18,8 +18,10 @@
*/
package org.apache.olingo.client.core.uri;
+import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
@@ -73,6 +75,11 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
protected final Map<String, String> queryOptions = new LinkedHashMap<String, String>();
/**
+ * Insertion-order map of parameter aliases.
+ */
+ protected final Map<String, String> parameters = new LinkedHashMap<String, String>();
+
+ /**
* Constructor.
*
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
@@ -97,6 +104,12 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
}
@Override
+ public UB addParameterAlias(final String alias, final String exp) {
+ parameters.put(alias, exp);
+ return getThis();
+ }
+
+ @Override
public UB appendEntitySetSegment(final String segmentValue) {
segments.add(new Segment(SegmentType.ENTITYSET, segmentValue));
return getThis();
@@ -193,7 +206,12 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
@Override
public UB filter(final URIFilter filter) {
- return addQueryOption(QueryOption.FILTER, filter.build());
+ try {
+ // decode in order to support @ in parameter aliases
+ return addQueryOption(QueryOption.FILTER, URLDecoder.decode(filter.build(), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ return addQueryOption(QueryOption.FILTER, filter.build());
+ }
}
@Override
@@ -271,6 +289,10 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
builder.addParameter("$" + option.getKey(), option.getValue());
}
+ for (Map.Entry<String, String> parameter : parameters.entrySet()) {
+ builder.addParameter("@" + parameter.getKey(), parameter.getValue());
+ }
+
return builder.build().normalize();
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Could not build valid URI", e);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java
new file mode 100644
index 0000000..dd3d67b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+/**
+ * Object to be used to communicate parameter alias into filter or orderBy expression.
+ */
+public class ParameterAlias {
+
+ /**
+ * Parameter alias.
+ */
+ final String alias;
+
+ /**
+ * Constructor.
+ *
+ * @param alias parameter alias.
+ */
+ public ParameterAlias(final String alias) {
+ this.alias = alias;
+ }
+
+ /**
+ * Gets parameter alias.
+ *
+ * @return
+ */
+ public String getAlias() {
+ return alias;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 8dce061..4159e76 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -225,12 +225,12 @@ public final class URIUtils {
return version == ODataServiceVersion.V30
? prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
- valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTime)
: URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8);
+ valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8);
}
private static String calendar(final ODataServiceVersion version, final Calendar calendar)
@@ -241,8 +241,8 @@ public final class URIUtils {
if (version == ODataServiceVersion.V30) {
result = prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
- valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTime);
} else {
if (calendar.get(Calendar.YEAR) == 0 && calendar.get(Calendar.MONTH) == 0
@@ -260,8 +260,8 @@ public final class URIUtils {
} else {
result = prefix(version, EdmPrimitiveTypeKind.DateTimeOffset)
+ URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTimeOffset);
}
@@ -273,11 +273,11 @@ public final class URIUtils {
return version == ODataServiceVersion.V30
? EdmTime.getInstance().toUriLiteral(URLEncoder.encode(EdmTime.getInstance().
- valueToString(duration, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
: EdmDuration.getInstance().toUriLiteral(URLEncoder.encode(EdmDuration.getInstance().
- valueToString(duration, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
}
private static String quoteString(final String string, final boolean singleQuoteEscape)
@@ -338,7 +338,9 @@ public final class URIUtils {
value = buffer.toString();
} else {
- value = (obj instanceof Boolean)
+ value = (obj instanceof ParameterAlias)
+ ? "@" + ((ParameterAlias) obj).getAlias().toString()
+ : (obj instanceof Boolean)
? BooleanUtils.toStringTrueFalse((Boolean) obj)
: (obj instanceof UUID)
? prefix(version, EdmPrimitiveTypeKind.Guid)
@@ -354,24 +356,24 @@ public final class URIUtils {
? duration(version, (Duration) obj)
: (obj instanceof BigDecimal)
? EdmDecimal.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Decimal)
: (obj instanceof Double)
? EdmDouble.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Double)
: (obj instanceof Float)
? EdmSingle.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Single)
: (obj instanceof Long)
? EdmInt64.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Int64)
: (obj instanceof Geospatial)
? URLEncoder.encode(EdmPrimitiveTypeFactory.getInstance(((Geospatial) obj).getEdmPrimitiveTypeKind()).
- valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
: (obj instanceof String)
? quoteString((String) obj, singleQuoteEscape)
: obj.toString();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
index e949780..6bfe116 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
@@ -29,6 +29,7 @@ import java.util.Map;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.uri.v3.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 {
@@ -101,6 +102,18 @@ public class URIBuilderTest extends AbstractTest {
}
@Test
+ public void filterWithParameter() throws URISyntaxException {
+ // http://host/service.svc/Employees?$filter=Region eq @p1&@p1='WA'
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Employees").
+ filter(getClient().getFilterFactory().eq("Region", new ParameterAlias("p1"))).
+ addParameterAlias("p1", "'WA'");
+
+ 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 unboundAction() throws URISyntaxException {
final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendOperationCallSegment("ProductsByCategoryId",
[04/51] [abbrv] [OLINGO-200] Introducing specialization for V3 and V4
domain objects
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
new file mode 100644
index 0000000..a1b729f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
@@ -0,0 +1,326 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.domain.AbstractODataPayload;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+
+/**
+ * OData entity.
+ */
+public abstract class AbstractODataEntity extends AbstractODataPayload implements CommonODataEntity {
+
+ private static final long serialVersionUID = 8360640095932811034L;
+
+ /**
+ * ETag.
+ */
+ private String eTag;
+
+ /**
+ * Media entity flag.
+ */
+ private boolean mediaEntity = false;
+
+ /**
+ * In case of media entity, media content type.
+ */
+ private String mediaContentType;
+
+ /**
+ * In case of media entity, media content source.
+ */
+ private String mediaContentSource;
+
+ /**
+ * Edit link.
+ */
+ private URI editLink;
+
+ /**
+ * Navigation links (might contain in-line entities or feeds).
+ */
+ private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Association links.
+ */
+ private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Media edit links.
+ */
+ private final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Operations (legacy, functions, actions).
+ */
+ private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
+
+ /**
+ * Constructor.
+ *
+ * @param name OData entity name.
+ */
+ public AbstractODataEntity(final String name) {
+ super(name);
+ }
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ @Override
+ public String getETag() {
+ return eTag;
+ }
+
+ /**
+ * Sets ETag.
+ *
+ * @param eTag ETag.
+ */
+ @Override
+ public void setETag(final String eTag) {
+ this.eTag = eTag;
+ }
+
+ /**
+ * Searches for operation with given title.
+ *
+ * @param title operation to look for
+ * @return operation if found with given title, <tt>null</tt> otherwise
+ */
+ @Override
+ public ODataOperation getOperation(final String title) {
+ ODataOperation result = null;
+ for (ODataOperation operation : operations) {
+ if (title.equals(operation.getTitle())) {
+ result = operation;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ @Override
+ public List<ODataOperation> getOperations() {
+ return this.operations;
+ }
+
+ /**
+ * Searches for property with given name.
+ *
+ * @param name property to look for
+ * @return property if found with given name, <tt>null</tt> otherwise
+ */
+ @Override
+ public CommonODataProperty getProperty(final String name) {
+ CommonODataProperty result = null;
+
+ if (StringUtils.isNotBlank(name)) {
+ for (CommonODataProperty property : getProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Puts the given link into one of available lists, based on its type.
+ *
+ * @param link to be added
+ * @return <tt>true</tt> if the given link was added in one of available lists
+ */
+ @Override
+ public boolean addLink(final ODataLink link) {
+ boolean result = false;
+
+ switch (link.getType()) {
+ case ASSOCIATION:
+ result = associationLinks.contains(link) ? false : associationLinks.add(link);
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
+ break;
+
+ case MEDIA_EDIT:
+ result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ /**
+ * Removes the given link from any list (association, navigation, edit-media).
+ *
+ * @param link to be removed
+ * @return <tt>true</tt> if the given link was contained in one of available lists
+ */
+ @Override
+ public boolean removeLink(final ODataLink link) {
+ return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
+ }
+
+ /**
+ * Returns all entity navigation links (including inline entities / feeds).
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ /**
+ * Returns all entity association links.
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ /**
+ * Returns all entity media edit links.
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getEditMediaLinks() {
+ return editMediaLinks;
+ }
+
+ /**
+ * Returns OData entity edit link.
+ *
+ * @return entity edit link.
+ */
+ @Override
+ public URI getEditLink() {
+ return editLink;
+ }
+
+ /**
+ * Sets OData entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ @Override
+ public void setEditLink(final URI editLink) {
+ this.editLink = editLink;
+ }
+
+ @Override
+ public URI getLink() {
+ return super.getLink() == null ? getEditLink() : super.getLink();
+ }
+
+ /**
+ * TRUE if read-only entity.
+ *
+ * @return TRUE if read-only; FALSE otherwise.
+ */
+ @Override
+ public boolean isReadOnly() {
+ return super.getLink() != null;
+ }
+
+ /**
+ * Checks if the current entity is a media entity.
+ *
+ * @return 'TRUE' if media entity; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isMediaEntity() {
+ return mediaEntity;
+ }
+
+ /**
+ * Sets media entity flag.
+ *
+ * @param isMediaEntity media entity flag value.
+ */
+ @Override
+ public void setMediaEntity(final boolean isMediaEntity) {
+ this.mediaEntity = isMediaEntity;
+ }
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ @Override
+ public String getMediaContentType() {
+ return mediaContentType;
+ }
+
+ /**
+ * Sets media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ @Override
+ public void setMediaContentType(final String mediaContentType) {
+ this.mediaContentType = mediaContentType;
+ }
+
+ /**
+ * Gets media content source.
+ *
+ * @return media content source.
+ */
+ @Override
+ public String getMediaContentSource() {
+ return mediaContentSource;
+ }
+
+ /**
+ * Sets media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ @Override
+ public void setMediaContentSource(final String mediaContentSource) {
+ this.mediaContentSource = mediaContentSource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java
new file mode 100644
index 0000000..b2f7dc8
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java
@@ -0,0 +1,73 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.AbstractODataPayload;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+
+public abstract class AbstractODataEntitySet extends AbstractODataPayload implements CommonODataEntitySet {
+
+ private static final long serialVersionUID = 9039605899821494024L;
+
+ /**
+ * Link to the next page.
+ */
+ private URI next;
+
+ /**
+ * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
+ * there.
+ */
+ private Integer count;
+
+ /**
+ * Constructor.
+ */
+ public AbstractODataEntitySet() {
+ super(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next link.
+ */
+ public AbstractODataEntitySet(final URI next) {
+ super(null);
+ this.next = next;
+ }
+
+ @Override
+ public URI getNext() {
+ return next;
+ }
+
+ protected abstract int getEntitiesSize();
+
+ @Override
+ public int getCount() {
+ return count == null ? getEntitiesSize() : count;
+ }
+
+ @Override
+ public void setCount(final int count) {
+ this.count = count;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
new file mode 100644
index 0000000..ea73910
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
@@ -0,0 +1,133 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public abstract class AbstractODataObjectFactory implements CommonODataObjectFactory {
+
+ private static final long serialVersionUID = -3769695665946919447L;
+
+ protected final ODataServiceVersion version;
+
+ public AbstractODataObjectFactory(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
+ final CommonODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
+ final CommonODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI link, final CommonODataEntity entity) {
+ return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
+ final CommonODataEntity entity) {
+
+ return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(version);
+ }
+
+ @Override
+ public ODataComplexValue newComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ODataCollectionValue newCollectionValue(final String typeName) {
+ return new ODataCollectionValueImpl(typeName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
new file mode 100644
index 0000000..c68dfab
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
@@ -0,0 +1,169 @@
+/*
+ * 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.commons.core.domain;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+
+public abstract class AbstractODataProperty implements CommonODataProperty {
+
+ private static final long serialVersionUID = 926939448778950450L;
+
+ /**
+ * Property name.
+ */
+ private final String name;
+
+ /**
+ * Property value.
+ */
+ private final ODataValue value;
+
+ /**
+ * Constructor.
+ *
+ * @param name property name.
+ * @param value property value.
+ */
+ public AbstractODataProperty(final String name, final ODataValue value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Returns property name.
+ *
+ * @return property name.
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns property value.
+ *
+ * @return property value.
+ */
+ @Override
+ public ODataValue getValue() {
+ return value;
+ }
+
+ /**
+ * Checks if has null value.
+ *
+ * @return 'TRUE' if has null value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasNullValue() {
+ return this.value == null;
+ }
+
+ /**
+ * Checks if has primitive value.
+ *
+ * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasPrimitiveValue() {
+ return !hasNullValue() && this.value.isPrimitive();
+ }
+
+ /**
+ * Gets primitive value.
+ *
+ * @return primitive value if exists; null otherwise.
+ */
+ @Override
+ public ODataPrimitiveValue getPrimitiveValue() {
+ return hasPrimitiveValue() ? this.value.asPrimitive() : null;
+ }
+
+ /**
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasComplexValue() {
+ return !hasNullValue() && this.value.isComplex();
+ }
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ @Override
+ public ODataComplexValue getComplexValue() {
+ return hasComplexValue() ? this.value.asComplex() : null;
+ }
+
+ /**
+ * Checks if has collection value.
+ *
+ * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasCollectionValue() {
+ return !hasNullValue() && this.value.isCollection();
+ }
+
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ @Override
+ public ODataCollectionValue getCollectionValue() {
+ return hasCollectionValue() ? this.value.asCollection() : null;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
index 07d6055..ba8fe56 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
@@ -23,7 +23,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.olingo.commons.api.domain.AbstractODataValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* OData complex property value.
@@ -35,7 +35,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo
/**
* Complex type fields.
*/
- private final Map<String, ODataProperty> fields = new LinkedHashMap<String, ODataProperty>();
+ private final Map<String, CommonODataProperty> fields = new LinkedHashMap<String, CommonODataProperty>();
/**
* Constructor.
@@ -52,7 +52,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo
* @param field field to be added.
*/
@Override
- public void add(final ODataProperty field) {
+ public void add(final CommonODataProperty field) {
fields.put(field.getName(), field);
}
@@ -63,7 +63,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo
* @return requested field.
*/
@Override
- public ODataProperty get(final String name) {
+ public CommonODataProperty get(final String name) {
return fields.get(name);
}
@@ -73,7 +73,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo
* @return fields iterator.
*/
@Override
- public Iterator<ODataProperty> iterator() {
+ public Iterator<CommonODataProperty> iterator() {
return fields.values().iterator();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
deleted file mode 100644
index 62d1e42..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
+++ /dev/null
@@ -1,372 +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.commons.core.domain;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.domain.AbstractODataPayload;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataOperation;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-
-/**
- * OData entity.
- */
-public class ODataEntityImpl extends AbstractODataPayload implements ODataEntity {
-
- private static final long serialVersionUID = 8360640095932811034L;
-
- /**
- * Entity reference.
- */
- private String reference;
-
- /**
- * ETag.
- */
- private String eTag;
-
- /**
- * Media entity flag.
- */
- private boolean mediaEntity = false;
-
- /**
- * In case of media entity, media content type.
- */
- private String mediaContentType;
-
- /**
- * In case of media entity, media content source.
- */
- private String mediaContentSource;
-
- /**
- * Edit link.
- */
- private URI editLink;
-
- /**
- * Navigation links (might contain in-line entities or feeds).
- */
- private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
-
- /**
- * Association links.
- */
- private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
-
- /**
- * Media edit links.
- */
- private final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
-
- /**
- * Operations (legacy, functions, actions).
- */
- private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
-
- /**
- * Entity properties.
- */
- private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
-
- /**
- * Constructor.
- *
- * @param name OData entity name.
- */
- public ODataEntityImpl(final String name) {
- super(name);
- }
-
- /**
- * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
- * to the resource path.
- * <br />
- * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
- * <br />
- * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
- * collection of entity references pointing to the related entities. If no entities are related, the response is the
- * format-specific representation of an empty collection.
- * <br />
- * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
- * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
- * such entity exists, the service returns 404 Not Found.
- *
- * @return entity reference.
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- @Override
- public void setReference(final String reference) {
- this.reference = reference;
- }
-
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
- @Override
- public String getETag() {
- return eTag;
- }
-
- /**
- * Sets ETag.
- *
- * @param eTag ETag.
- */
- @Override
- public void setETag(final String eTag) {
- this.eTag = eTag;
- }
-
- /**
- * Searches for operation with given title.
- *
- * @param title operation to look for
- * @return operation if found with given title, <tt>null</tt> otherwise
- */
- @Override
- public ODataOperation getOperation(final String title) {
- ODataOperation result = null;
- for (ODataOperation operation : operations) {
- if (title.equals(operation.getTitle())) {
- result = operation;
- }
- }
-
- return result;
- }
-
- /**
- * Gets operations.
- *
- * @return operations.
- */
- @Override
- public List<ODataOperation> getOperations() {
- return this.operations;
- }
-
- /**
- * Searches for property with given name.
- *
- * @param name property to look for
- * @return property if found with given name, <tt>null</tt> otherwise
- */
- @Override
- public ODataProperty getProperty(final String name) {
- ODataProperty result = null;
-
- if (StringUtils.isNotBlank(name)) {
- for (ODataProperty property : properties) {
- if (name.equals(property.getName())) {
- result = property;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Returns OData entity properties.
- *
- * @return OData entity properties.
- */
- @Override
- public List<ODataProperty> getProperties() {
- return properties;
- }
-
- /**
- * Puts the given link into one of available lists, based on its type.
- *
- * @param link to be added
- * @return <tt>true</tt> if the given link was added in one of available lists
- */
- @Override
- public boolean addLink(final ODataLink link) {
- boolean result = false;
-
- switch (link.getType()) {
- case ASSOCIATION:
- result = associationLinks.contains(link) ? false : associationLinks.add(link);
- break;
-
- case ENTITY_NAVIGATION:
- case ENTITY_SET_NAVIGATION:
- result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
- break;
-
- case MEDIA_EDIT:
- result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
- break;
-
- default:
- }
-
- return result;
- }
-
- /**
- * Removes the given link from any list (association, navigation, edit-media).
- *
- * @param link to be removed
- * @return <tt>true</tt> if the given link was contained in one of available lists
- */
- @Override
- public boolean removeLink(final ODataLink link) {
- return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
- }
-
- /**
- * Returns all entity navigation links (including inline entities / feeds).
- *
- * @return OData entity links.
- */
- @Override
- public List<ODataLink> getNavigationLinks() {
- return navigationLinks;
- }
-
- /**
- * Returns all entity association links.
- *
- * @return OData entity links.
- */
- @Override
- public List<ODataLink> getAssociationLinks() {
- return associationLinks;
- }
-
- /**
- * Returns all entity media edit links.
- *
- * @return OData entity links.
- */
- @Override
- public List<ODataLink> getEditMediaLinks() {
- return editMediaLinks;
- }
-
- /**
- * Returns OData entity edit link.
- *
- * @return entity edit link.
- */
- @Override
- public URI getEditLink() {
- return editLink;
- }
-
- /**
- * Sets OData entity edit link.
- *
- * @param editLink edit link.
- */
- @Override
- public void setEditLink(final URI editLink) {
- this.editLink = editLink;
- }
-
- @Override
- public URI getLink() {
- return super.getLink() == null ? getEditLink() : super.getLink();
- }
-
- /**
- * TRUE if read-only entity.
- *
- * @return TRUE if read-only; FALSE otherwise.
- */
- @Override
- public boolean isReadOnly() {
- return super.getLink() != null;
- }
-
- /**
- * Checks if the current entity is a media entity.
- *
- * @return 'TRUE' if media entity; 'FALSE' otherwise.
- */
- @Override
- public boolean isMediaEntity() {
- return mediaEntity;
- }
-
- /**
- * Sets media entity flag.
- *
- * @param isMediaEntity media entity flag value.
- */
- @Override
- public void setMediaEntity(final boolean isMediaEntity) {
- this.mediaEntity = isMediaEntity;
- }
-
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
- @Override
- public String getMediaContentType() {
- return mediaContentType;
- }
-
- /**
- * Sets media content type.
- *
- * @param mediaContentType media content type.
- */
- @Override
- public void setMediaContentType(final String mediaContentType) {
- this.mediaContentType = mediaContentType;
- }
-
- /**
- * Gets media content source.
- *
- * @return media content source.
- */
- @Override
- public String getMediaContentSource() {
- return mediaContentSource;
- }
-
- /**
- * Sets media content source.
- *
- * @param mediaContentSource media content source.
- */
- @Override
- public void setMediaContentSource(final String mediaContentSource) {
- this.mediaContentSource = mediaContentSource;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
deleted file mode 100644
index b7246d1..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
+++ /dev/null
@@ -1,104 +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.commons.core.domain;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.commons.api.domain.AbstractODataPayload;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-
-public class ODataEntitySetImpl extends AbstractODataPayload implements ODataEntitySet {
-
- private static final long serialVersionUID = 9039605899821494024L;
-
- /**
- * Link to the next page.
- */
- private URI next;
-
- /**
- * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
- * there.
- */
- private Integer count;
-
- /**
- * OData entities contained in this feed.
- */
- private List<ODataEntity> entities = new ArrayList<ODataEntity>();
-
- /**
- * Constructor.
- */
- public ODataEntitySetImpl() {
- super(null);
- }
-
- /**
- * Constructor.
- *
- * @param next next link.
- */
- public ODataEntitySetImpl(final URI next) {
- super(null);
- this.next = next;
- }
-
- /**
- * Gets next page link.
- *
- * @return next page link; null value if single page or last page reached.
- */
- @Override
- public URI getNext() {
- return next;
- }
-
- /**
- * Gets contained entities.
- *
- * @return feed entries.
- */
- @Override
- public List<ODataEntity> getEntities() {
- return entities;
- }
-
- /**
- * Gets in-line count.
- *
- * @return in-line count value.
- */
- @Override
- public int getCount() {
- return count == null ? entities.size() : count;
- }
-
- /**
- * Sets in-line count.
- *
- * @param count in-line count value.
- */
- @Override
- public void setCount(final int count) {
- this.count = count;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
deleted file mode 100644
index 63a47ce..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
+++ /dev/null
@@ -1,171 +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.commons.core.domain;
-
-import java.net.URI;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public class ODataObjectFactoryImpl implements ODataObjectFactory {
-
- private static final long serialVersionUID = -3769695665946919447L;
-
- protected final ODataServiceVersion version;
-
- public ODataObjectFactoryImpl(final ODataServiceVersion version) {
- this.version = version;
- }
-
- @Override
- public ODataEntitySet newEntitySet() {
- return new ODataEntitySetImpl();
- }
-
- @Override
- public ODataEntitySet newEntitySet(final URI next) {
- return new ODataEntitySetImpl(next);
- }
-
- @Override
- public ODataEntity newEntity(final String name) {
- return new ODataEntityImpl(name);
- }
-
- @Override
- public ODataEntity newEntity(final String name, final URI link) {
- final ODataEntityImpl result = new ODataEntityImpl(name);
- result.setLink(link);
- return result;
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
- return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
- final ODataEntity entity) {
-
- return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
- return new ODataPrimitiveValueImpl.BuilderImpl(version);
- }
-
- @Override
- public ODataComplexValue newComplexValue(final String typeName) {
- return new ODataComplexValueImpl(typeName);
- }
-
- @Override
- public ODataCollectionValue newCollectionValue(final String typeName) {
- return new ODataCollectionValueImpl(typeName);
- }
-
- @Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
- return new ODataPropertyImpl(name, value);
- }
-
- @Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
- return new ODataPropertyImpl(name, value);
- }
-
- @Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
- return new ODataPropertyImpl(name, value);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
deleted file mode 100644
index 4c8aea9..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
+++ /dev/null
@@ -1,172 +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.commons.core.domain;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
-
-/**
- * OData entity property.
- */
-public class ODataPropertyImpl implements ODataProperty {
-
- private static final long serialVersionUID = 926939448778950450L;
-
- /**
- * Property name.
- */
- private final String name;
-
- /**
- * Property value.
- */
- private ODataValue value;
-
- /**
- * Constructor.
- *
- * @param name property name.
- * @param value property value.
- */
- public ODataPropertyImpl(final String name, final ODataValue value) {
- this.name = name;
- this.value = value;
- }
-
- /**
- * Returns property name.
- *
- * @return property name.
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Returns property value.
- *
- * @return property value.
- */
- @Override
- public ODataValue getValue() {
- return value;
- }
-
- /**
- * Checks if has null value.
- *
- * @return 'TRUE' if has null value; 'FALSE' otherwise.
- */
- @Override
- public boolean hasNullValue() {
- return this.value == null;
- }
-
- /**
- * Checks if has primitive value.
- *
- * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
- */
- @Override
- public boolean hasPrimitiveValue() {
- return !hasNullValue() && this.value.isPrimitive();
- }
-
- /**
- * Gets primitive value.
- *
- * @return primitive value if exists; null otherwise.
- */
- @Override
- public ODataPrimitiveValue getPrimitiveValue() {
- return hasPrimitiveValue() ? this.value.asPrimitive() : null;
- }
-
- /**
- * Checks if has complex value.
- *
- * @return 'TRUE' if has complex value; 'FALSE' otherwise.
- */
- @Override
- public boolean hasComplexValue() {
- return !hasNullValue() && this.value.isComplex();
- }
-
- /**
- * Gets complex value.
- *
- * @return complex value if exists; null otherwise.
- */
- @Override
- public ODataComplexValue getComplexValue() {
- return hasComplexValue() ? this.value.asComplex() : null;
- }
-
- /**
- * Checks if has collection value.
- *
- * @return 'TRUE' if has collection value; 'FALSE' otherwise.
- */
- @Override
- public boolean hasCollectionValue() {
- return !hasNullValue() && this.value.isCollection();
- }
-
- /**
- * Gets collection value.
- *
- * @return collection value if exists; null otherwise.
- */
- @Override
- public ODataCollectionValue getCollectionValue() {
- return hasCollectionValue() ? this.value.asCollection() : null;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntityImpl.java
new file mode 100644
index 0000000..8a41e7a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntityImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataEntity;
+
+public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity {
+
+ private static final long serialVersionUID = 1728326493032709855L;
+
+ private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
+
+ public ODataEntityImpl(final String name) {
+ super(name);
+ }
+
+ @Override
+ public ODataProperty getProperty(final String name) {
+ return (ODataProperty) super.getProperty(name);
+ }
+
+ @Override
+ public List<ODataProperty> getProperties() {
+ return properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntitySetImpl.java
new file mode 100644
index 0000000..83870f3
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntitySetImpl.java
@@ -0,0 +1,51 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.core.domain.AbstractODataEntitySet;
+
+public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataEntitySet {
+
+ private static final long serialVersionUID = -8127933181196033586L;
+
+ private final List<ODataEntity> entities = new ArrayList<ODataEntity>();
+
+ public ODataEntitySetImpl() {
+ }
+
+ public ODataEntitySetImpl(final URI next) {
+ super(next);
+ }
+
+ @Override
+ protected int getEntitiesSize() {
+ return entities.size();
+ }
+
+ @Override
+ public List<ODataEntity> getEntities() {
+ return entities;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
new file mode 100644
index 0000000..2bfb8f5
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
@@ -0,0 +1,75 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.AbstractODataObjectFactory;
+
+public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implements ODataObjectFactory {
+
+ public ODataObjectFactoryImpl(final ODataServiceVersion version) {
+ super(version);
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet() {
+ return new ODataEntitySetImpl();
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet(final URI next) {
+ return new ODataEntitySetImpl(next);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name) {
+ return new ODataEntityImpl(name);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name, final URI link) {
+ final ODataEntityImpl result = new ODataEntityImpl(name);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
new file mode 100644
index 0000000..68c44ec
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
@@ -0,0 +1,33 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataProperty;
+
+public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty {
+
+ private static final long serialVersionUID = 4851331227420757747L;
+
+ public ODataPropertyImpl(final String name, final ODataValue value) {
+ super(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
new file mode 100644
index 0000000..b5ac799
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
@@ -0,0 +1,62 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataEntity;
+
+public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity {
+
+ private static final long serialVersionUID = -3997704808753685990L;
+
+ /**
+ * Entity reference.
+ */
+ private String reference;
+
+ private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
+
+ public ODataEntityImpl(final String name) {
+ super(name);
+ }
+
+ @Override
+ public String getReference() {
+ return reference;
+ }
+
+ @Override
+ public void setReference(final String reference) {
+ this.reference = reference;
+ }
+
+ @Override
+ public ODataProperty getProperty(final String name) {
+ return (ODataProperty) super.getProperty(name);
+ }
+
+ @Override
+ public List<ODataProperty> getProperties() {
+ return properties;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
new file mode 100644
index 0000000..cbc5a04
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
@@ -0,0 +1,51 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.core.domain.AbstractODataEntitySet;
+
+public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataEntitySet {
+
+ private static final long serialVersionUID = -8127933181196033586L;
+
+ private final List<ODataEntity> entities = new ArrayList<ODataEntity>();
+
+ public ODataEntitySetImpl() {
+ }
+
+ public ODataEntitySetImpl(final URI next) {
+ super(next);
+ }
+
+ @Override
+ protected int getEntitiesSize() {
+ return entities.size();
+ }
+
+ @Override
+ public List<ODataEntity> getEntities() {
+ return entities;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
new file mode 100644
index 0000000..1b6428f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.domain.v4;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+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.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.AbstractODataObjectFactory;
+
+public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implements ODataObjectFactory {
+
+ public ODataObjectFactoryImpl(final ODataServiceVersion version) {
+ super(version);
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet() {
+ return new ODataEntitySetImpl();
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet(final URI next) {
+ return new ODataEntitySetImpl(next);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name) {
+ return new ODataEntityImpl(name);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name, final URI link) {
+ final ODataEntityImpl result = new ODataEntityImpl(name);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newEnumProperty(final String name, final ODataEnumValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
new file mode 100644
index 0000000..fe6bf9d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataProperty;
+
+public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty {
+
+ private static final long serialVersionUID = 4851331227420757747L;
+
+ public ODataPropertyImpl(final String name, final org.apache.olingo.commons.api.domain.ODataValue value) {
+ super(name, value);
+ }
+
+ @Override
+ public boolean hasEnumValue() {
+ return !hasNullValue() && getValue() instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
+ && ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).isEnum();
+ }
+
+ @Override
+ public ODataEnumValue getEnumValue() {
+ return hasEnumValue() ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asEnum() : null;
+ }
+
+}
[45/51] [abbrv] git commit: [OLINGO-233] HTTP proxy enabled
HttpClientFactory provided
Posted by sk...@apache.org.
[OLINGO-233] HTTP proxy enabled HttpClientFactory provided
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/1e8eaecf
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/1e8eaecf
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/1e8eaecf
Branch: refs/heads/olingo-206-validator
Commit: 1e8eaecf066817802945595a5410a104132f1283
Parents: 16d3b02
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Apr 2 16:44:39 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Apr 2 16:44:39 2014 +0200
----------------------------------------------------------------------
.../AbstractBasicAuthHttpClientFactory.java | 51 ------------
.../http/AbstractNTLMAuthHttpClientFactory.java | 63 --------------
.../core/http/BasicAuthHttpClientFactory.java | 55 +++++++++++++
.../core/http/NTLMAuthHttpClientFactory.java | 73 +++++++++++++++++
.../http/ProxyWrapperHttpClientFactory.java | 86 ++++++++++++++++++++
.../it/v3/AuthEntityRetrieveTestITCase.java | 16 +---
6 files changed, 216 insertions(+), 128 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1e8eaecf/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractBasicAuthHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractBasicAuthHttpClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractBasicAuthHttpClientFactory.java
deleted file mode 100644
index 806bfb5..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractBasicAuthHttpClientFactory.java
+++ /dev/null
@@ -1,51 +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.http;
-
-import java.net.URI;
-
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.HttpClient;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.olingo.client.api.http.HttpMethod;
-
-/**
- * Base implementation for working with Basic Authentication: needs to be subclassed in order to provide actual username
- * and password.
- */
-public abstract class AbstractBasicAuthHttpClientFactory extends DefaultHttpClientFactory {
-
- private static final long serialVersionUID = 7985626503125490244L;
-
- protected abstract String getUsername();
-
- protected abstract String getPassword();
-
- @Override
- public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
- final DefaultHttpClient httpclient = (DefaultHttpClient) super.createHttpClient(method, uri);
-
- httpclient.getCredentialsProvider().setCredentials(
- new AuthScope(uri.getHost(), uri.getPort()),
- new UsernamePasswordCredentials(getUsername(), getPassword()));
-
- return httpclient;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1e8eaecf/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractNTLMAuthHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractNTLMAuthHttpClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractNTLMAuthHttpClientFactory.java
deleted file mode 100644
index e7c0ca0..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractNTLMAuthHttpClientFactory.java
+++ /dev/null
@@ -1,63 +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.http;
-
-import java.net.URI;
-
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.NTCredentials;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.HttpClient;
-import org.apache.http.impl.client.BasicCredentialsProvider;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.olingo.client.api.http.HttpMethod;
-
-/**
- * Base implementation for working with NTLM Authentication via embedded HttpClient features: needs to be subclassed in
- * order to provide all needed login information.
- * <br/>
- * External NTLM engine such as <a href="http://jcifs.samba.org/">JCIFS</a> library developed by the
- * <a href="http://www.samba.org/">Samba</a> project as a part of their Windows interoperability suite of programs.
- *
- * @see NTCredentials
- * @see http://hc.apache.org/httpcomponents-client-ga/ntlm.html#Using_Samba_JCIFS_as_an_alternative_NTLM_engine
- */
-public abstract class AbstractNTLMAuthHttpClientFactory extends DefaultHttpClientFactory {
-
- protected abstract String getUsername();
-
- protected abstract String getPassword();
-
- protected abstract String getWorkstation();
-
- protected abstract String getDomain();
-
- @Override
- public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
- final DefaultHttpClient httpclient = (DefaultHttpClient) super.createHttpClient(method, uri);
-
- final CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(AuthScope.ANY,
- new NTCredentials(getUsername(), getPassword(), getWorkstation(), getDomain()));
-
- httpclient.setCredentialsProvider(credsProvider);
-
- return httpclient;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1e8eaecf/lib/client-core/src/main/java/org/apache/olingo/client/core/http/BasicAuthHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/BasicAuthHttpClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/BasicAuthHttpClientFactory.java
new file mode 100644
index 0000000..b978621
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/BasicAuthHttpClientFactory.java
@@ -0,0 +1,55 @@
+/*
+ * 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.http;
+
+import java.net.URI;
+
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Implementation for working with Basic Authentication.
+ */
+public class BasicAuthHttpClientFactory extends DefaultHttpClientFactory {
+
+ private static final long serialVersionUID = 7985626503125490244L;
+
+ private final String username;
+
+ private final String password;
+
+ public BasicAuthHttpClientFactory(final String username, final String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ final DefaultHttpClient httpclient = (DefaultHttpClient) super.createHttpClient(method, uri);
+
+ httpclient.getCredentialsProvider().setCredentials(
+ new AuthScope(uri.getHost(), uri.getPort()),
+ new UsernamePasswordCredentials(username, password));
+
+ return httpclient;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1e8eaecf/lib/client-core/src/main/java/org/apache/olingo/client/core/http/NTLMAuthHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/NTLMAuthHttpClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/NTLMAuthHttpClientFactory.java
new file mode 100644
index 0000000..202fc9a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/NTLMAuthHttpClientFactory.java
@@ -0,0 +1,73 @@
+/*
+ * 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.http;
+
+import java.net.URI;
+
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.NTCredentials;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Implementation for working with NTLM Authentication via embedded HttpClient features.
+ * <br/>
+ * External NTLM engine such as <a href="http://jcifs.samba.org/">JCIFS</a> library developed by the
+ * <a href="http://www.samba.org/">Samba</a> project as a part of their Windows interoperability suite of programs.
+ *
+ * @see NTCredentials
+ * @see http://hc.apache.org/httpcomponents-client-ga/ntlm.html#Using_Samba_JCIFS_as_an_alternative_NTLM_engine
+ */
+public class NTLMAuthHttpClientFactory extends DefaultHttpClientFactory {
+
+ private static final long serialVersionUID = 9060120943020134668L;
+
+ private final String username;
+
+ private final String password;
+
+ private final String workstation;
+
+ private final String domain;
+
+ public NTLMAuthHttpClientFactory(final String username, final String password,
+ final String workstation, final String domain) {
+
+ this.username = username;
+ this.password = password;
+ this.workstation = workstation;
+ this.domain = domain;
+ }
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ final DefaultHttpClient httpclient = (DefaultHttpClient) super.createHttpClient(method, uri);
+
+ final CredentialsProvider credsProvider = new BasicCredentialsProvider();
+ credsProvider.setCredentials(AuthScope.ANY,
+ new NTCredentials(username, password, workstation, domain));
+
+ httpclient.setCredentialsProvider(credsProvider);
+
+ return httpclient;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1e8eaecf/lib/client-core/src/main/java/org/apache/olingo/client/core/http/ProxyWrapperHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/ProxyWrapperHttpClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/ProxyWrapperHttpClientFactory.java
new file mode 100644
index 0000000..ab57901
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/ProxyWrapperHttpClientFactory.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.http;
+
+import java.net.URI;
+import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.params.ConnRoutePNames;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.client.api.http.HttpClientFactory;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Implementation for working behind an HTTP proxy (possibly requiring authentication); requires another concrete
+ * {@link HttpClientFactory} implementation acting as real HTTP client factory.
+ */
+public class ProxyWrapperHttpClientFactory implements HttpClientFactory {
+
+ private final URI proxy;
+
+ private String proxyUsername;
+
+ private String proxyPassword;
+
+ private final DefaultHttpClientFactory wrapped;
+
+ public ProxyWrapperHttpClientFactory(final URI proxy) {
+ this(proxy, null, null, new DefaultHttpClientFactory());
+ }
+
+ public ProxyWrapperHttpClientFactory(final URI proxy, final String proxyUsername, final String proxyPassword) {
+ this(proxy, proxyUsername, proxyPassword, new DefaultHttpClientFactory());
+ }
+
+ public ProxyWrapperHttpClientFactory(final URI proxy, final DefaultHttpClientFactory wrapped) {
+ this(proxy, null, null, wrapped);
+ }
+
+ public ProxyWrapperHttpClientFactory(final URI proxy,
+ final String proxyUsername, final String proxyPassword, final DefaultHttpClientFactory wrapped) {
+
+ this.proxy = proxy;
+ this.proxyUsername = proxyUsername;
+ this.proxyPassword = proxyPassword;
+ this.wrapped = wrapped;
+ }
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ // Use wrapped factory to obtain an httpclient instance for given method and uri
+ final DefaultHttpClient httpclient = (DefaultHttpClient) wrapped.createHttpClient(method, uri);
+
+ final HttpHost proxyHost = new HttpHost(proxy.getHost(), proxy.getPort());
+
+ // Sets usage of HTTP proxy
+ httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost);
+
+ // Sets proxy authentication, if credentials were provided
+ if (proxyUsername != null && proxyPassword != null) {
+ httpclient.getCredentialsProvider().setCredentials(
+ new AuthScope(proxyHost),
+ new UsernamePasswordCredentials(proxyUsername, proxyPassword));
+ }
+
+ return httpclient;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1e8eaecf/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AuthEntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AuthEntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AuthEntityRetrieveTestITCase.java
index 9d98270..686e5ca 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AuthEntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AuthEntityRetrieveTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-import org.apache.olingo.client.core.http.AbstractBasicAuthHttpClientFactory;
+import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -27,19 +27,7 @@ public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
@BeforeClass
public static void enableBasicAuth() {
- client.getConfiguration().setHttpClientFactory(new AbstractBasicAuthHttpClientFactory() {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected String getUsername() {
- return "odatajclient";
- }
-
- @Override
- protected String getPassword() {
- return "odatajclient";
- }
- });
+ client.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
}
@AfterClass
[26/51] [abbrv] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4
Posted by sk...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/525767c0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/525767c0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/525767c0
Branch: refs/heads/olingo-206-validator
Commit: 525767c0c9803a9d23b9df025c9e03b95ebf2a99
Parents: 1fa6676 d4c2484
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 14:16:58 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 14:16:58 2014 +0200
----------------------------------------------------------------------
.gitignore | 2 ++
pom.xml | 2 ++
2 files changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/525767c0/pom.xml
----------------------------------------------------------------------
[32/51] [abbrv] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4
Posted by sk...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/9806a273
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/9806a273
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/9806a273
Branch: refs/heads/olingo-206-validator
Commit: 9806a2737cc50631b7372ee722714ea9d30e849f
Parents: 6aaec81 ac385b5
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 16:16:35 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 16:16:35 2014 +0200
----------------------------------------------------------------------
.../resources/v3/Car/filter/VIN add 5 lt 11.xml | 61 +++---
.../resources/v3/Car/filter/VIN div 2 le 8.xml | 23 +--
.../v3/Car/filter/VIN le 18 and VIN gt 12.xml | 23 +--
.../resources/v3/Car/filter/VIN mul 2 le 30.xml | 23 +--
.../filter/day(PurchaseDate) eq 15.xml | 23 +--
.../filter/hour(PurchaseDate) eq 1.xml | 23 +--
.../filter/minute(PurchaseDate) eq 33.xml | 23 +--
.../filter/month(PurchaseDate) eq 12.xml | 23 +--
.../filter/second(PurchaseDate) eq 35.xml | 23 +--
.../filter/year(PurchaseDate) eq 2020.xml | 23 +--
.../filter/isof(Name,'Edm.String') eq true.xml | 22 +--
.../resources/v3/InStreamErrorGetCustomer.xml | 197 ++++++++++++-------
pom.xml | 71 ++++---
13 files changed, 210 insertions(+), 348 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9806a273/pom.xml
----------------------------------------------------------------------
[14/51] [abbrv] [OLINGO-200] V4 ODataValue full reachable via API
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
index 3dc766e..325f2dd 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
@@ -19,11 +19,72 @@
package org.apache.olingo.client.core.it.v3;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.UpdateType;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
+import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
+import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.junit.BeforeClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractTestITCase {
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractTestITCase.class);
+
+ protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product";
-public abstract class AbstractTestITCase extends org.apache.olingo.client.core.it.AbstractTestITCase {
+ protected static final String servicesODataServiceRootURL =
+ "http://services.odata.org/V3/(S(csquyjnoaywmz5xcdbfhlc1p))/OData/OData.svc/";
protected static ODataClient client;
@@ -45,8 +106,473 @@ public abstract class AbstractTestITCase extends org.apache.olingo.client.core.i
client = ODataClientFactory.getV3();
}
- @Override
protected ODataClient getClient() {
return client;
}
+
+ protected void checkLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
+ assertTrue(original.size() <= actual.size());
+
+ for (ODataLink originalLink : original) {
+ ODataLink foundOriginal = null;
+ ODataLink foundActual = null;
+
+ for (ODataLink actualLink : actual) {
+
+ if (actualLink.getType() == originalLink.getType()
+ && (originalLink.getLink() == null
+ || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString()))
+ && actualLink.getName().equals(originalLink.getName())) {
+
+ foundOriginal = originalLink;
+ foundActual = actualLink;
+ }
+ }
+
+ assertNotNull(foundOriginal);
+ assertNotNull(foundActual);
+
+ if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
+ final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
+ assertNotNull(originalInline);
+
+ final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
+ assertNotNull(actualInline);
+
+ checkProperties(originalInline.getProperties(), actualInline.getProperties());
+ }
+ }
+ }
+
+ protected void checkProperties(final Collection<? extends CommonODataProperty> original,
+ final Collection<? extends CommonODataProperty> actual) {
+
+ assertTrue(original.size() <= actual.size());
+
+ // re-organize actual properties into a Map<String, ODataProperty>
+ final Map<String, CommonODataProperty> actualProps = new HashMap<String, CommonODataProperty>(actual.size());
+
+ for (CommonODataProperty prop : actual) {
+ assertFalse(actualProps.containsKey(prop.getName()));
+ actualProps.put(prop.getName(), prop);
+ }
+
+ assertTrue(actual.size() <= actualProps.size());
+
+ for (CommonODataProperty prop : original) {
+ assertNotNull(prop);
+ if (actualProps.containsKey(prop.getName())) {
+ final CommonODataProperty actualProp = actualProps.get(prop.getName());
+ assertNotNull(actualProp);
+
+ if (prop.getValue() != null && actualProp.getValue() != null) {
+ checkPropertyValue(prop.getName(), prop.getValue(), actualProp.getValue());
+ }
+ } else {
+ // nothing ... maybe :FC_KeepInContent="false"
+ // ..... no assert can be done ....
+ }
+ }
+ }
+
+ protected void checkPropertyValue(final String propertyName,
+ final ODataValue original, final ODataValue actual) {
+
+ assertNotNull("Null original value for " + propertyName, original);
+ assertNotNull("Null actual value for " + propertyName, actual);
+
+ assertEquals("Type mismatch for '" + propertyName + "': "
+ + original.getClass().getSimpleName() + "-" + actual.getClass().getSimpleName(),
+ original.getClass().getSimpleName(), actual.getClass().getSimpleName());
+
+ if (original.isComplex()) {
+ final List<CommonODataProperty> originalFileds = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : original.asComplex()) {
+ originalFileds.add(prop);
+ }
+
+ final List<CommonODataProperty> actualFileds = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : actual.asComplex()) {
+ actualFileds.add(prop);
+ }
+
+ checkProperties(originalFileds, actualFileds);
+ } else if (original.isCollection()) {
+ assertTrue(original.asCollection().size() <= actual.asCollection().size());
+
+ boolean found = original.asCollection().isEmpty();
+
+ for (ODataValue originalValue : original.asCollection()) {
+ for (ODataValue actualValue : actual.asCollection()) {
+ try {
+ checkPropertyValue(propertyName, originalValue, actualValue);
+ found = true;
+ } catch (AssertionError ignore) {
+ // ignore
+ }
+ }
+ }
+
+ assertTrue("Found " + actual + " but expected " + original, found);
+ } else {
+ assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive().
+ getTypeKind() + "-" + actual.asPrimitive().getTypeKind(),
+ original.asPrimitive().getTypeKind().equals(actual.asPrimitive().getTypeKind()));
+
+ assertEquals("Primitive value for '" + propertyName + "' mismatch: " + original.asPrimitive().toString()
+ + "-" + actual.asPrimitive().toString(),
+ original.asPrimitive().toString(), actual.asPrimitive().toString());
+ }
+ }
+
+ protected ODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
+ final ODataEntity entity = getClient().getObjectFactory().newEntity(
+ "Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
+ entity.setMediaEntity(true);
+
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("Information",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).
+ setType(EdmPrimitiveTypeKind.String).build()));
+
+ return entity;
+ }
+
+ protected ODataEntity getSampleCustomerProfile(
+ final int id, final String sampleName, final boolean withInlineInfo) {
+
+ final ODataEntity entity =
+ getClient().getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
+
+ // add name attribute
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("Name",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).
+ setType(EdmPrimitiveTypeKind.String).build()));
+
+ // add key attribute
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+
+ // add BackupContactInfo attribute (collection)
+ final ODataCollectionValue<ODataValue> backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
+ "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
+
+ // add BackupContactInfo.ContactDetails attribute (complex)
+ final ODataComplexValue<ODataProperty> contactDetails = getClient().getObjectFactory().newComplexValue(
+ "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
+ backupContactInfoValue.add(contactDetails);
+
+ // add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
+ final ODataCollectionValue<ODataValue> altNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ altNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setText("myname").setType(EdmPrimitiveTypeKind.String).build());
+ contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
+
+ // add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
+ final ODataCollectionValue<ODataValue> emailBagValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ emailBagValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
+ contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
+
+ // add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
+ final ODataComplexValue<ODataProperty> contactAliasValue = getClient().getObjectFactory().newComplexValue(
+ "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
+ contactDetails.add(getClient().getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
+
+ // add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
+ final ODataCollectionValue<ODataValue> aliasAltNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ aliasAltNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
+ contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
+
+ if (withInlineInfo) {
+ final ODataInlineEntity inlineInfo = getClient().getObjectFactory().newInlineEntity(
+ "Info",
+ URI.create("Customer(" + id + ")/Info"),
+ getSampleCustomerInfo(id, sampleName + "_Info"));
+ inlineInfo.getEntity().setMediaEntity(true);
+ entity.addLink(inlineInfo);
+ }
+
+ return entity;
+ }
+
+ protected void debugEntry(final Entry entry, final String message) {
+ if (LOG.isDebugEnabled()) {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer().entry(entry, writer);
+ writer.flush();
+ LOG.debug(message + "\n{}", writer.toString());
+ }
+ }
+
+ protected void debugFeed(final Feed feed, final String message) {
+ if (LOG.isDebugEnabled()) {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer().feed(feed, writer);
+ writer.flush();
+ LOG.debug(message + "\n{}", writer.toString());
+ }
+ }
+
+ protected void debugODataProperty(final ODataProperty property, final String message) {
+ LOG.debug(message + "\n{}", property.toString());
+ }
+
+ protected void debugODataValue(final ODataValue value, final String message) {
+ LOG.debug(message + "\n{}", value.toString());
+ }
+
+ protected void debugODataEntity(final ODataEntity entity, final String message) {
+ if (LOG.isDebugEnabled()) {
+ StringWriter writer = new StringWriter();
+ getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, AtomEntryImpl.class), writer);
+ writer.flush();
+ LOG.debug(message + " (Atom)\n{}", writer.toString());
+
+ writer = new StringWriter();
+ getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, JSONEntryImpl.class), writer);
+ writer.flush();
+ LOG.debug(message + " (JSON)\n{}", writer.toString());
+ }
+ }
+
+ protected void debugInputStream(final InputStream input, final String message) {
+ if (LOG.isDebugEnabled()) {
+ try {
+ LOG.debug(message + "\n{}", IOUtils.toString(input));
+ } catch (IOException e) {
+ LOG.error("Error writing stream", e);
+ } finally {
+ IOUtils.closeQuietly(input);
+ }
+ }
+ }
+
+ protected String getETag(final URI uri) {
+ final ODataRetrieveResponse<ODataEntity> res = getClient().getRetrieveRequestFactory().
+ getEntityRequest(uri).execute();
+ try {
+ return res.getEtag();
+ } finally {
+ res.close();
+ }
+ }
+
+ protected ODataEntity read(final ODataPubFormat format, final URI editLink) {
+ final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().
+ getEntityRequest(editLink);
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataEntity> res = req.execute();
+ final ODataEntity entity = res.getBody();
+
+ assertNotNull(entity);
+
+ if (ODataPubFormat.JSON_FULL_METADATA == format || ODataPubFormat.ATOM == format) {
+ assertEquals(req.getURI(), entity.getEditLink());
+ }
+
+ return entity;
+ }
+
+ protected ODataEntity createEntity(
+ final String serviceRootURL,
+ final ODataPubFormat format,
+ final ODataEntity original,
+ final String entitySetName) {
+
+ final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
+ appendEntitySetSegment(entitySetName);
+
+ debugODataEntity(original, "About to create");
+
+ final ODataEntityCreateRequest<ODataEntity> createReq =
+ getClient().getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
+ createReq.setFormat(format);
+
+ final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
+ assertEquals(201, createRes.getStatusCode());
+ assertEquals("Created", createRes.getStatusMessage());
+
+ final ODataEntity created = createRes.getBody();
+ assertNotNull(created);
+
+ debugODataEntity(created, "Just created");
+
+ return created;
+ }
+
+ protected ODataEntity compareEntities(final String serviceRootURL,
+ final ODataPubFormat format,
+ final ODataEntity original,
+ final int actualObjectId,
+ final Collection<String> expands) {
+
+ final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
+ appendEntitySetSegment("Customer").appendKeySegment(actualObjectId);
+
+ // search expanded
+ if (expands != null) {
+ for (String expand : expands) {
+ uriBuilder.expand(expand);
+ }
+ }
+
+ final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataEntity> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+
+ final ODataEntity actual = res.getBody();
+ assertNotNull(actual);
+
+ // check defined links
+ checkLinks(original.getAssociationLinks(), actual.getAssociationLinks());
+ checkLinks(original.getEditMediaLinks(), actual.getEditMediaLinks());
+ checkLinks(original.getNavigationLinks(), actual.getNavigationLinks());
+
+ // check defined properties equality
+ checkProperties(original.getProperties(), actual.getProperties());
+
+ return actual;
+ }
+
+ protected void cleanAfterCreate(
+ final ODataPubFormat format,
+ final ODataEntity created,
+ final boolean includeInline,
+ final String baseUri) {
+
+ final Set<URI> toBeDeleted = new HashSet<URI>();
+ toBeDeleted.add(created.getEditLink());
+
+ if (includeInline) {
+ for (ODataLink link : created.getNavigationLinks()) {
+ if (link instanceof ODataInlineEntity) {
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ if (inline.getEditLink() != null) {
+ toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
+ }
+ }
+
+ if (link instanceof ODataInlineEntitySet) {
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ for (CommonODataEntity entity : inline.getEntities()) {
+ if (entity.getEditLink() != null) {
+ toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
+ }
+ }
+ }
+ }
+ }
+
+ assertFalse(toBeDeleted.isEmpty());
+
+ for (URI link : toBeDeleted) {
+ final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(link);
+ final ODataDeleteResponse deleteRes = deleteReq.execute();
+
+ assertEquals(204, deleteRes.getStatusCode());
+ assertEquals("No Content", deleteRes.getStatusMessage());
+
+ deleteRes.close();
+
+ final ODataEntityRequest<ODataEntity> retrieveReq = getClient().getRetrieveRequestFactory().
+ getEntityRequest(link);
+ // bug that needs to be fixed on the SampleService - cannot get entity not found with header
+ // Accept: application/json;odata=minimalmetadata
+ retrieveReq.setFormat(format == ODataPubFormat.JSON_FULL_METADATA ? ODataPubFormat.JSON : format);
+
+ Exception exception = null;
+ try {
+ retrieveReq.execute();
+ fail();
+ } catch (ODataClientErrorException e) {
+ exception = e;
+ assertEquals(404, e.getStatusLine().getStatusCode());
+ }
+ assertNotNull(exception);
+ }
+ }
+
+ protected void updateEntityDescription(
+ final ODataPubFormat format, final ODataEntity changes, final UpdateType type) {
+
+ updateEntityDescription(format, changes, type, null);
+ }
+
+ protected void updateEntityDescription(
+ final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+
+ updateEntityStringProperty("Description", format, changes, type, etag);
+ }
+
+ protected void updateEntityStringProperty(final String propertyName,
+ final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+
+ final URI editLink = changes.getEditLink();
+
+ final String newm = "New " + propertyName + "(" + System.currentTimeMillis() + ")";
+
+ ODataProperty propertyValue = changes.getProperty(propertyName);
+
+ final String oldm;
+ if (propertyValue == null) {
+ oldm = null;
+ } else {
+ oldm = propertyValue.getValue().toString();
+ changes.getProperties().remove(propertyValue);
+ }
+
+ assertNotEquals(newm, oldm);
+
+ getClient().getBinder().add(changes,
+ getClient().getObjectFactory().newPrimitiveProperty(propertyName,
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
+
+ update(type, changes, format, etag);
+
+ final ODataEntity actual = read(format, editLink);
+
+ propertyValue = null;
+
+ for (ODataProperty prop : actual.getProperties()) {
+ if (prop.getName().equals(propertyName)) {
+ propertyValue = prop;
+ }
+ }
+
+ assertNotNull(propertyValue);
+ assertEquals(newm, propertyValue.getValue().toString());
+ }
+
+ protected void update(
+ final UpdateType type, final ODataEntity changes, final ODataPubFormat format, final String etag) {
+ final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory().getEntityUpdateRequest(type, changes);
+
+ if (getClient().getConfiguration().isUseXHTTPMethod()) {
+ assertEquals(HttpMethod.POST, req.getMethod());
+ } else {
+ assertEquals(type.getMethod(), req.getMethod());
+ }
+ req.setFormat(format);
+
+ if (StringUtils.isNotBlank(etag)) {
+ req.setIfMatch(etag); // Product include ETag header into the response .....
+ }
+
+ final ODataEntityUpdateResponse res = req.execute();
+ assertEquals(204, res.getStatusCode());
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 2a4efee..c6a7c15 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -18,6 +18,11 @@
*/
package org.apache.olingo.client.core.it.v3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
@@ -37,21 +42,14 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -68,10 +66,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 1;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
+ final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -80,10 +78,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 2;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
+ final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -92,10 +90,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithInlineAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 3;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual =
+ final ODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
cleanAfterCreate(format, actual, true, getServiceRoot());
@@ -106,10 +104,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 4;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual =
+ final ODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
cleanAfterCreate(format, actual, true, getServiceRoot());
@@ -119,13 +117,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createInlineWithoutLinkAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 5;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
original.addLink(client.getObjectFactory().newInlineEntity(
"Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual =
+ final ODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
boolean found = false;
@@ -146,13 +144,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createInlineWithoutLinkAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 6;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
original.addLink(client.getObjectFactory().newInlineEntity(
"Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual =
+ final ODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
boolean found = false;
@@ -172,7 +170,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createWithNavigationAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity actual = createWithNavigationLink(format, 5);
+ final ODataEntity actual = createWithNavigationLink(format, 5);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -180,14 +178,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithNavigationAsJSON() {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity actual = createWithNavigationLink(format, 6);
+ final ODataEntity actual = createWithNavigationLink(format, 6);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
public void createWithFeedNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity actual = createWithFeedNavigationLink(format, 7);
+ final ODataEntity actual = createWithFeedNavigationLink(format, 7);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -195,14 +193,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithFeedNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity actual = createWithFeedNavigationLink(format, 8);
+ final ODataEntity actual = createWithFeedNavigationLink(format, 8);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
public void createWithBackNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity actual = createWithBackNavigationLink(format, 9);
+ final ODataEntity actual = createWithBackNavigationLink(format, 9);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@@ -210,7 +208,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithBackNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity actual = createWithBackNavigationLink(format, 10);
+ final ODataEntity actual = createWithBackNavigationLink(format, 10);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@@ -227,13 +225,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createReturnNoContent() {
final int id = 1;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = (ODataEntity) getSampleCustomerProfile(id, "Sample customer", false);
- final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
+ final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").build(), original);
createReq.setPrefer(new ODataPreferences(client.getServiceVersion()).returnNoContent());
- final ODataEntityCreateResponse createRes = createReq.execute();
+ final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
assertEquals(204, createRes.getStatusCode());
assertEquals(new ODataPreferences(client.getServiceVersion()).returnNoContent(),
createRes.getHeader(HeaderName.preferenceApplied).iterator().next());
@@ -255,10 +253,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Ignore
public void issue135() {
final int id = 2;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer for issue 135", false);
+ final ODataEntity original = (ODataEntity) getSampleCustomerProfile(id, "Sample customer for issue 135", false);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer");
- final ODataEntityCreateRequest createReq =
+ final ODataEntityCreateRequest<ODataEntity> createReq =
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
createReq.setFormat(ODataPubFormat.JSON_FULL_METADATA);
createReq.setContentType(ContentType.APPLICATION_ATOM_XML.getMimeType());
@@ -278,18 +276,18 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
}
- private CommonODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
+ private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
throws EdmPrimitiveTypeException {
final String sampleName = "Sample customer";
- final CommonODataEntity original = getSampleCustomerProfile(id, sampleName, false);
+ final ODataEntity original = (ODataEntity) getSampleCustomerProfile(id, sampleName, false);
final Set<Integer> keys = new HashSet<Integer>();
keys.add(-100);
keys.add(-101);
for (Integer key : keys) {
- final CommonODataEntity order =
+ final ODataEntity order =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
getClient().getBinder().add(order,
@@ -301,7 +299,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
setType(EdmPrimitiveTypeKind.Int32).build()));
- final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
+ final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order);
createReq.setFormat(format);
@@ -310,9 +308,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
createReq.execute().getBody().getEditLink()));
}
- final CommonODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
+ final ODataEntity created = (ODataEntity) createEntity(getServiceRoot(), format, original, "Customer");
// now, compare the created one with the actual one and go deeply into the associated customer info.....
- final CommonODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
+ final ODataEntity actual = (ODataEntity) compareEntities(getServiceRoot(), format, created, id, null);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
@@ -324,11 +322,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- final CommonODataEntitySet entitySet = res.getBody();
+ final ODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
assertEquals(2, entitySet.getCount());
- for (CommonODataEntity entity : entitySet.getEntities()) {
+ for (ODataEntity entity : entitySet.getEntities()) {
final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(keys.contains(key));
@@ -345,16 +343,16 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private CommonODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
+ private ODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
final String sampleName = "Sample customer";
- final CommonODataEntity original = getSampleCustomerProfile(id, sampleName, false);
+ final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
original.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info", URI.create(getServiceRoot() + "/CustomerInfo(12)")));
- final CommonODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
+ final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
// now, compare the created one with the actual one and go deeply into the associated customer info.....
- final CommonODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
+ final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
@@ -365,12 +363,12 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
- final CommonODataEntity info = res.getBody();
+ final ODataEntity info = res.getBody();
assertNotNull(info);
boolean found = false;
- for (CommonODataProperty prop : info.getProperties()) {
+ for (ODataProperty prop : info.getProperties()) {
if ("CustomerInfoId".equals(prop.getName())) {
assertEquals("12", prop.getValue().toString());
found = true;
@@ -382,7 +380,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private CommonODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
+ private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
throws EdmPrimitiveTypeException {
final String sampleName = "Sample customer";
@@ -451,7 +449,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
private void multiKey(final ODataPubFormat format) {
- final CommonODataEntity message = client.getObjectFactory().newEntity(
+ final ODataEntity message = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
getClient().getBinder().add(message,
@@ -481,11 +479,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> builder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");
- final ODataEntityCreateRequest req = client.getCUDRequestFactory().getEntityCreateRequest(builder.build(),
- message);
+ final ODataEntityCreateRequest<ODataEntity> req = client.getCUDRequestFactory().
+ getEntityCreateRequest(builder.build(), message);
req.setFormat(format);
- final ODataEntityCreateResponse res = req.execute();
+ final ODataEntityCreateResponse<ODataEntity> res = req.execute();
assertNotNull(res);
assertEquals(201, res.getStatusCode());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 6ed898d..223f908 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -27,7 +27,6 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateR
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -53,7 +52,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final CommonODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
merge.setEditLink(uri);
updateEntityDescription(format, merge, UpdateType.MERGE, etag);
}
@@ -64,7 +63,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final CommonODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
merge.setEditLink(uri);
updateEntityDescription(format, merge, UpdateType.MERGE, etag);
}
@@ -75,7 +74,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final CommonODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
patch.setEditLink(uri);
updateEntityDescription(format, patch, UpdateType.PATCH, etag);
}
@@ -86,7 +85,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final CommonODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
patch.setEditLink(uri);
updateEntityDescription(format, patch, UpdateType.PATCH, etag);
}
@@ -94,7 +93,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void replaceAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
+ final ODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -102,7 +101,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void replaceAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
+ final ODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -121,7 +120,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).build();
- final CommonODataEntity patch =
+ final ODataEntity patch =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
patch.setEditLink(uri);
@@ -141,7 +140,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(customerInfoURI);
req.setFormat(format);
- CommonODataEntity newInfo = req.execute().getBody();
+ ODataEntity newInfo = req.execute().getBody();
assertEquals(Integer.valueOf(12),
newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
@@ -179,7 +178,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
multiKey.put("FromUsername", "1");
multiKey.put("MessageId", -10);
- final CommonODataEntity message = read(format, client.getURIBuilder(getServiceRoot()).
+ final ODataEntity message = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Message").appendKeySegment(multiKey).build());
message.getAssociationLinks().clear();
message.getNavigationLinks().clear();
@@ -226,7 +225,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
String etag = getETag(uri);
- final CommonODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
product.setEditLink(uri);
updateEntityStringProperty("BaseConcurrency",
client.getConfiguration().getDefaultPubFormat(), product, UpdateType.MERGE, etag);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
index 4a9d05f..1b4892d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
@@ -22,7 +22,6 @@ import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.junit.AfterClass;
@@ -68,10 +67,10 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
public void createODataEntityAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 1;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(testStaticServiceRootURL, format, original, "Customer");
- final CommonODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
+ final ODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
cleanAfterCreate(format, actual, false, testStaticServiceRootURL);
}
@@ -80,10 +79,10 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
public void createODataEntityAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 2;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(testStaticServiceRootURL, format, original, "Customer");
- final CommonODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
+ final ODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
cleanAfterCreate(format, actual, false, testStaticServiceRootURL);
}
@@ -91,7 +90,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void replaceODataEntityAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
+ final ODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -99,7 +98,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void replaceODataEntityAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
+ final ODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index 3b518d9..1972fec 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -18,6 +18,11 @@
*/
package org.apache.olingo.client.core.it.v3;
+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.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -39,22 +44,18 @@ import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-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 org.junit.Ignore;
import org.junit.Test;
@@ -66,7 +67,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 20, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 20, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create navigation link with JSON full metadata
@@ -76,7 +77,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 21, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 21, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// throws Null pointer exception when the format is JSON No metadata
@@ -86,7 +87,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
final String contentType = "application/json;odata=nometadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 22, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 22, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON accept and atom content type
@@ -97,7 +98,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 23, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 23, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON full metadata in format and json no metadata in content type
@@ -107,7 +108,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=nometadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 24, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 24, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON no metadata format and json no metadata in content type
@@ -117,7 +118,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 25, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 25, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create collection navigation link with ATOM
@@ -127,7 +128,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final CommonODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
+ final ODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create collection navigation link with JSON
@@ -137,22 +138,22 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
+ final ODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create a navigation link
- public CommonODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
+ public ODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
final String prefer) {
final String name = "Customer Navigation test";
- final CommonODataEntity original = getNewCustomer(id, name, false);
+ final ODataEntity original = getNewCustomer(id, name, false);
original.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info", URI.create(testStaticServiceRootURL + "/CustomerInfo(11)")));
- final CommonODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
+ final ODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
prefer);
- final CommonODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
+ final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
@@ -175,38 +176,38 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// create a navigation link
- public CommonODataEntity createNav(final String url, final ODataPubFormat format, final CommonODataEntity original,
+ public ODataEntity createNav(final String url, final ODataPubFormat format, final ODataEntity original,
final String entitySetName, final String contentType, final String prefer) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(url);
uriBuilder.appendEntitySetSegment(entitySetName);
- final ODataEntityCreateRequest createReq =
+ final ODataEntityCreateRequest<ODataEntity> createReq =
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
createReq.setFormat(format);
createReq.setContentType(contentType);
createReq.setPrefer(prefer);
- final ODataEntityCreateResponse createRes = createReq.execute();
+ final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
assertEquals(201, createRes.getStatusCode());
assertEquals("Created", createRes.getStatusMessage());
- final CommonODataEntity created = createRes.getBody();
+ final ODataEntity created = createRes.getBody();
assertNotNull(created);
return created;
}
// create collection navigation link
- public CommonODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
+ public ODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
final String contentType, final String prefer) throws EdmPrimitiveTypeException {
{
final String name = "Collection Navigation Key Customer";
- final CommonODataEntity original = getNewCustomer(id, name, false);
+ final ODataEntity original = getNewCustomer(id, name, false);
final Set<Integer> navigationKeys = new HashSet<Integer>();
navigationKeys.add(-118);
navigationKeys.add(-119);
for (Integer key : navigationKeys) {
- final CommonODataEntity orderEntity =
+ final ODataEntity orderEntity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
getClient().getBinder().add(orderEntity,
@@ -218,7 +219,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
setType(EdmPrimitiveTypeKind.Int32).build()));
- final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
+ final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
orderEntity);
createReq.setFormat(format);
@@ -227,9 +228,9 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
"Orders",
createReq.execute().getBody().getEditLink()));
}
- final CommonODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
+ final ODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
contentType, prefer);
- final CommonODataEntity actualEntity =
+ final ODataEntity actualEntity =
validateEntities(testStaticServiceRootURL, format, createdEntity, id, null, "Customer");
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
@@ -242,12 +243,12 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- final CommonODataEntitySet entitySet = res.getBody();
+ final ODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
assertEquals(2, entitySet.getCount());
- for (CommonODataEntity entity : entitySet.getEntities()) {
+ for (ODataEntity entity : entitySet.getEntities()) {
final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(navigationKeys.contains(key));
@@ -265,10 +266,10 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// get a Customer entity to be created
- public CommonODataEntity getNewCustomer(
+ public ODataEntity getNewCustomer(
final int id, final String name, final boolean withInlineInfo) {
- final CommonODataEntity entity =
+ final ODataEntity entity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
// add name attribute
@@ -284,35 +285,35 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
setType(EdmPrimitiveTypeKind.Int32).build()));
}
- final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
+ final ODataCollectionValue<ODataValue> backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
- final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
+ final ODataComplexValue<ODataProperty> contactDetails = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
- final ODataCollectionValue altNamesValue = getClient().getObjectFactory().
+ final ODataCollectionValue<ODataValue> altNamesValue = getClient().getObjectFactory().
newCollectionValue("Collection(Edm.String)");
altNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
- final ODataCollectionValue emailBagValue = getClient().getObjectFactory().
+ final ODataCollectionValue<ODataValue> emailBagValue = getClient().getObjectFactory().
newCollectionValue("Collection(Edm.String)");
emailBagValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
- final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue(
+ final ODataComplexValue<ODataProperty> contactAliasValue = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
contactDetails.add(client.getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
- final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory().
+ final ODataCollectionValue<ODataValue> aliasAltNamesValue = getClient().getObjectFactory().
newCollectionValue("Collection(Edm.String)");
aliasAltNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
- final ODataComplexValue homePhone = getClient().getObjectFactory().newComplexValue(
+ final ODataComplexValue<ODataProperty> homePhone = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
client.getObjectFactory().newPrimitiveValueBuilder().setText("8437568356834568").
@@ -338,7 +339,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
//delete an entity and associated links after creation
- public void delete(final ODataPubFormat format, final CommonODataEntity created, final boolean includeInline,
+ public void delete(final ODataPubFormat format, final ODataEntity created, final boolean includeInline,
final String baseUri) {
final Set<URI> toBeDeleted = new HashSet<URI>();
toBeDeleted.add(created.getEditLink());
@@ -376,8 +377,8 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// add Information property
- public CommonODataEntity getInfo(final int id, final String info) {
- final CommonODataEntity entity =
+ public ODataEntity getInfo(final int id, final String info) {
+ final ODataEntity entity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
entity.setMediaEntity(true);
@@ -388,9 +389,9 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// validate newly created entities
- public CommonODataEntity validateEntities(final String serviceRootURL,
+ public ODataEntity validateEntities(final String serviceRootURL,
final ODataPubFormat format,
- final CommonODataEntity original,
+ final ODataEntity original,
final int actualObjectId,
final Collection<String> expands, final String entitySetName) {
@@ -501,7 +502,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
final List<CommonODataProperty> actualPropertyValue = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : (ODataComplexValue) actual) {
+ for (CommonODataProperty prop : actual.asComplex()) {
actualPropertyValue.add(prop);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index f576a03..3a90d70 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -18,9 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -28,10 +25,11 @@ import java.util.UUID;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmSchema;
@@ -43,6 +41,10 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Ignore;
import org.junit.Test;
@@ -61,10 +63,10 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
// assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType());
}
- private CommonODataEntity readRow(final ODataPubFormat format, final String uuid) {
- final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ private ODataEntity readRow(final ODataPubFormat format, final String uuid) {
+ final URIBuilder builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid));
- return read(format, builder.build());
+ return (ODataEntity) read(format, builder.build());
}
private void read(final ODataPubFormat format) {
@@ -91,7 +93,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
private void cud(final ODataPubFormat format) {
final UUID guid = UUID.randomUUID();
- CommonODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
+ ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
getClient().getBinder().add(row,
client.getObjectFactory().newPrimitiveProperty("Id",
client.getObjectFactory().newPrimitiveValueBuilder().
@@ -192,7 +194,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(geoColl).build()));
- final ODataComplexValue contactDetails = client.getObjectFactory().newComplexValue(
+ final ODataComplexValue<ODataProperty> contactDetails = client.getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("FirstContacted",
client.getObjectFactory().newPrimitiveValueBuilder().
@@ -233,11 +235,11 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
getClient().getBinder().add(row,
client.getObjectFactory().newComplexProperty("aContact", contactDetails));
- final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
+ final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().
getEntityCreateRequest(client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Row").build(), row);
createReq.setFormat(format);
- final ODataEntityCreateResponse createRes = createReq.execute();
+ final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
assertEquals(201, createRes.getStatusCode());
row = readRow(format, guid.toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index 9d10d24..f98e12a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -18,6 +18,11 @@
*/
package org.apache.olingo.client.core.it.v3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
@@ -36,14 +41,11 @@ import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@@ -218,7 +220,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final String newItem = "new item " + System.currentTimeMillis();
- final ODataCollectionValue originalValue =
+ final ODataCollectionValue<ODataValue> originalValue =
primaryContactInfo.getComplexValue().get("EmailBag").getCollectionValue();
final int origSize = originalValue.size();
@@ -266,7 +268,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final String newItem = "new item " + System.currentTimeMillis();
- final ODataCollectionValue originalValue = alternativeNames.getCollectionValue();
+ final ODataCollectionValue<ODataValue> originalValue = alternativeNames.getCollectionValue();
final int origSize = originalValue.size();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
index a745380..28cb871 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
@@ -23,7 +23,7 @@ import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
import org.junit.BeforeClass;
-public abstract class AbstractTestITCase extends org.apache.olingo.client.core.it.AbstractTestITCase {
+public abstract class AbstractTestITCase {
protected static ODataClient client;
@@ -45,7 +45,6 @@ public abstract class AbstractTestITCase extends org.apache.olingo.client.core.i
client = ODataClientFactory.getV4();
}
- @Override
protected ODataClient getClient() {
return client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
index 7806fd0..989dd98 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
@@ -18,6 +18,11 @@
*/
package org.apache.olingo.client.core.it.v4;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.net.URI;
import java.util.LinkedHashMap;
import java.util.List;
@@ -27,7 +32,6 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataRawReque
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
@@ -38,12 +42,6 @@ import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.core.op.ResourceFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -81,9 +79,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
assertNotNull(inline);
- debugEntry(client.getBinder().getEntry(
- inline, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)), "Just read");
-
final List<? extends CommonODataProperty> properties = inline.getProperties();
assertEquals(5, properties.size());
@@ -136,9 +131,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
assertNotNull(inline);
- debugFeed(client.getBinder().getFeed(inline, ResourceFactory.feedClassForFormat(
- format == ODataPubFormat.ATOM)), "Just read");
-
found = true;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index c354a1d..bc0905c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -36,7 +36,6 @@ import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.core.op.ResourceFactory;
import org.junit.Ignore;
import org.junit.Test;
@@ -109,9 +108,6 @@ public class EntitySetTestITCase extends AbstractTestITCase {
assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People"));
- debugFeed(client.getBinder().getFeed(feed, ResourceFactory.feedClassForFormat(
- ODataPubFormat.ATOM == format)), "Just retrieved feed");
-
assertEquals(5, feed.getEntities().size());
assertNotNull(feed.getNext());
[30/51] [abbrv] [OLINGO-227] fix minor xml issues
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml b/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml
index cef8ad6..79b934b 100644
--- a/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml
+++ b/fit/src/main/resources/v3/ComputerDetail/filter/year(PurchaseDate) eq 2020.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,24 +19,4 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/da
taservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolz
qssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail</id><title type="text">ComputerDetail</title><updated>2014-02-13T14:31:05Z</updated><link rel="self" title="ComputerDetail" href="ComputerDetail" /><entry><id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="app
lication/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2014-02-13T14:31:05Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="
true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry></feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml b/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml
index d749910..be808a3 100644
--- a/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml
+++ b/fit/src/main/resources/v3/Customer/filter/isof(Name,'Edm.String') eq true.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -18,27 +19,6 @@
under the License.
-->
-<?xml version="1.0" encoding="utf-8"?><!--
-
- Copyright © Microsoft Open Technologies, Inc.
-
- All Rights Reserved
-
- Licensed 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
-
- THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
- PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
-
- See the Apache License, Version 2.0 for the specific language
- governing permissions and limitations under the License.
-
--->
<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Customer</id>
<title type="text">Customer</title>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml b/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml
index 6653876..e836bd1 100644
--- a/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml
+++ b/fit/src/main/resources/v3/InStreamErrorGetCustomer.xml
@@ -1,25 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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.
-->
-<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/InStreamErrorGetCustomer</id>
<title type="text">InStreamErrorGetCustomer</title>
<updated>2014-02-12T14:03:09Z</updated>
@@ -28,18 +30,25 @@
<id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Customer(-10)</id>
<category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Customer" href="Customer(-10)" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="Customer(-10)/Orders" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Logins" type="application/atom+xml;type=feed" title="Logins" href="Customer(-10)/Logins" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Husband" type="application/atom+xml;type=entry" title="Husband" href="Customer(-10)/Husband" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Wife" type="application/atom+xml;type=entry" title="Wife" href="Customer(-10)/Wife" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Info" type="application/atom+xml;type=entry" title="Info" href="Customer(-10)/Info" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders" type="application/atom+xml;type=feed"
+ title="Orders" href="Customer(-10)/Orders" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Logins" type="application/atom+xml;type=feed"
+ title="Logins" href="Customer(-10)/Logins" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Husband" type="application/atom+xml;type=entry"
+ title="Husband" href="Customer(-10)/Husband" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Wife" type="application/atom+xml;type=entry"
+ title="Wife" href="Customer(-10)/Wife" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Info" type="application/atom+xml;type=entry"
+ title="Info" href="Customer(-10)/Info" />
<title />
- <summary type="text">commastartedtotalnormaloffsetsregisteredgroupcelestialexposureconventionsimportcastclass</summary>
+ <summary type="text">commastartedtotalnormaloffsetsregisteredgroupcelestialexposureconventionsimportcastclass
+ </summary>
<updated>2014-02-12T14:03:09Z</updated>
<author>
<name />
</author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Thumbnail" title="Thumbnail" href="Customer(-10)/Thumbnail" />
+ <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Thumbnail" title="Thumbnail"
+ href="Customer(-10)/Thumbnail" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Customer(-10)/Video" />
<content type="application/xml">
<m:properties>
@@ -52,14 +61,16 @@
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>グぁマせぺネソぁぼソひバたぴソ歹九ネボボяポソ畚クяせべ歹珱Я欲タハバミ裹ぼボをヲ歹んひ九ひ匚ぁa</d:element>
- <d:element>qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta</d:element>
+ <d:element>qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta
+ </d:element>
<d:element>btsnhqrjqryqzgxducl</d:element>
<d:element>qbtlssjhunufmzdv</d:element>
<d:element>ボんЯぜチべゼボボほa匚ミぼ九ぁひチ珱黑ミんぁタび暦クソソボゾんんあゼぞひタボタぜん弌ひべ匚</d:element>
<d:element>vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae</d:element>
<d:element>九ソミせボぜゾボёaをぜЯまゾタぜタひ縷ダんaバたゼソ</d:element>
<d:element>ぽマタぁぁ黑ソゼミゼ匚zソダマぁァゾぽミaタゾ弌ミゼタそzぺポせ裹バポハハヲぺチあマ匚ミ</d:element>
- <d:element>hssiißuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbdßjnelxqttkhdalabibuqhiubtßsptrmzelud</d:element>
+ <d:element>hssiißuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbdßjnelxqttkhdalabibuqhiubtßsptrmzelud
+ </d:element>
<d:element>gbjssllxzzxkmßppyyrhgmoeßizlcmsuqqnvjßudszevtfunflqzqcuubukypßqjcix</d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
@@ -69,18 +80,23 @@
<d:element>esgmrxddisdvykgttpmizcethjuazqxemuossopssaqpmqdßkayrrocgsxqpo</d:element>
<d:element>クソ珱べをマんグハひボソソんミソソゼンぞたぼzミ歹ぴ</d:element>
<d:element>ljrggbaseqsrkelksvhouoscmoilogibae</d:element>
- <d:element>そぜぜママゼミぼゼボべソほあんせひびゼミソ弌ほそタボマチタマソネ弌チポ匚まソゾマЯЯたゾ裹あ畚ん弌た珱畚マЯソァ珱ネびё九たミミぴぺポマゼダ弌ミマママソボ亜ぺソ匚グ弌グ歹ハま匚そん黑ん</d:element>
- <d:element>ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl</d:element>
- <d:element>たёタЯяまひぺァ暦ソマポハクタせたひァ暦ヲ九暦ぞぜチ匚欲ゼほ九ぺ畚びぞポボクぴをチチそボソマポんぽミァ弌ァぞぴまミ縷黑ミゼゼzチミソ暦ゼほ畚ソ匚ネёほゼボぴポゼ縷ソチポ裹ヲ縷九ン歹a九ソソ</d:element>
+ <d:element>そぜぜママゼミぼゼボべソほあんせひびゼミソ弌ほそタボマチタマソネ弌チポ匚まソゾマЯЯたゾ裹あ畚ん弌た珱畚マЯソァ珱ネびё九たミミぴぺポマゼダ弌ミマママソボ亜ぺソ匚グ弌グ歹ハま匚そん黑ん
+ </d:element>
+ <d:element>ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl
+ </d:element>
+ <d:element>たёタЯяまひぺァ暦ソマポハクタせたひァ暦ヲ九暦ぞぜチ匚欲ゼほ九ぺ畚びぞポボクぴをチチそボソマポんぽミァ弌ァぞぴまミ縷黑ミゼゼzチミソ暦ゼほ畚ソ匚ネёほゼボぴポゼ縷ソチポ裹ヲ縷九ン歹a九ソソ
+ </d:element>
</d:AlternativeNames>
</d:ContactAlias>
<d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
- <d:PhoneNumber>畚ぼせゼぽチ欲を縷弌ポタぺゾ欲a歹まマ亜チぁゼゼaマァゾぞあ弌そをポダボグびゼァたチ珱べぴゼタzボネァァ歹ぞゼ欲欲マソチぺんび暦ンタぺダzぴダポ縷ァボЯべぺべタびグ珱たミソぽひぼミ暦マミ歹そ欲ゼёべポ</d:PhoneNumber>
+ <d:PhoneNumber>畚ぼせゼぽチ欲を縷弌ポタぺゾ欲a歹まマ亜チぁゼゼaマァゾぞあ弌そをポダボグびゼァたチ珱べぴゼタzボネァァ歹ぞゼ欲欲マソチぺんび暦ンタぺダzぴダポ縷ァボЯべぺべタびグ珱たミソぽひぼミ暦マミ歹そ欲ゼёべポ
+ </d:PhoneNumber>
<d:Extension>jqjklhnnkyhujailcedbguyectpuamgbghreatqvobbtj</d:Extension>
</d:HomePhone>
<d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
<d:PhoneNumber>そマ弌あハミゼぼマ匚ソバzチぴソぁんёタゾゼソせぴボひハネゼぽべァたぺゾチァそ</d:PhoneNumber>
- <d:Extension>erpdbdvgezuztcsyßpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkadeßustxßf</d:Extension>
+ <d:Extension>erpdbdvgezuztcsyßpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkadeßustxßf
+ </d:Extension>
</d:WorkPhone>
<d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
<d:element>
@@ -104,7 +120,8 @@
<d:Extension>aゾ暦ヲaゾをチёゼをぽァ亜ぽひぞポ裹ぼぜゼソミネミ暦ぽぽべべミ匚aぞチボネヲ黑暦たほタクチダё珱ネををチソ</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu</d:PhoneNumber>
+ <d:PhoneNumber>bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu
+ </d:PhoneNumber>
<d:Extension>
</d:Extension>
</d:element>
@@ -117,7 +134,8 @@
<d:Extension>バゼぼクグ</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>zチ亜ネンaバそ珱グせ亜ンネヲん歹ま亜aポタミぜ弌珱ミゼЯほんボ裹я九ぁァ珱ぼクゼポネァネ珱ゼまゼあハマまネぼゼ歹ポぴたべべそボぁソ珱ヲぺ黑ンネёゼダЯタゼそzソソンzボボァ黑匚んべポポ</d:PhoneNumber>
+ <d:PhoneNumber>zチ亜ネンaバそ珱グせ亜ンネヲん歹ま亜aポタミぜ弌珱ミゼЯほんボ裹я九ぁァ珱ぼクゼポネァネ珱ゼまゼあハマまネぼゼ歹ポぴたべべそボぁソ珱ヲぺ黑ンネёゼダЯタゼそzソソンzボボァ黑匚んべポポ
+ </d:PhoneNumber>
<d:Extension>gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg</d:Extension>
</d:element>
</d:MobilePhoneBag>
@@ -127,22 +145,27 @@
<d:EmailBag m:type="Collection(Edm.String)" />
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>まミボあ弌ミんヲをミグミをzソボソポタzべ裹タ畚グぁ暦また裹九ぽマそ九ぽ歹ゼ九マソたそマЯぽぜゼゼ暦ハハバ珱ダグぴ亜マミaя欲ゼヲぜЯぴぴひ弌ё黑歹ゾあ</d:element>
- <d:element>ぜヲグ畚ァをたポ珱チグああミЯ亜ゼァミミ黑ぽ裹ぺぼЯダマ匚ァゾハァ裹ハ匚ダたゾぜ暦ソひボ欲せミん黑ああ九せそz歹ぁたボァ九ソ縷ゾせ弌ミびぞぺべぽ珱バ黑ソそまゼひをほ亜マぽミゾ</d:element>
+ <d:element>ぜヲグ畚ァをたポ珱チグああミЯ亜ゼァミミ黑ぽ裹ぺぼЯダマ匚ァゾハァ裹ハ匚ダたゾぜ暦ソひボ欲せミん黑ああ九せそz歹ぁたボァ九ソ縷ゾせ弌ミびぞぺべぽ珱バ黑ソそまゼひをほ亜マぽミゾ
+ </d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>uhgnrnahnbsyvzlbltutlemsbcgdlchlxtsdpzkthvueixlxaelaq</d:element>
- <d:element>pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp</d:element>
+ <d:element>pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp
+ </d:element>
<d:element>eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi</d:element>
- <d:element>ёЯポぞミ暦亜タァぜ珱Яゼ縷ミボぜポハぺバまポぴたゾソチチァポま畚ひネネクンタせゾソポあゼぜё九ネべぽゼぁハま九ァソンぼクべヲЯゼチぞぽ黑九ぽそぞゾミぞボバ弌ぁソマチクあぼほま畚</d:element>
- <d:element>adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukrßßßirygjzsssktizcikerysklohuonekujmutsxuvdbacrj</d:element>
+ <d:element>ёЯポぞミ暦亜タァぜ珱Яゼ縷ミボぜポハぺバまポぴたゾソチチァポま畚ひネネクンタせゾソポあゼぜё九ネべぽゼぁハま九ァソンぼクべヲЯゼチぞぽ黑九ぽそぞゾミぞボバ弌ぁソマチクあぼほま畚
+ </d:element>
+ <d:element>adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukrßßßirygjzsssktizcikerysklohuonekujmutsxuvdbacrj
+ </d:element>
<d:element>uahsvudmlßdtbxxm</d:element>
<d:element>yulcdchqqcvrrmzhaeens</d:element>
<d:element>vxiefursgkqzptijhincpdm</d:element>
</d:AlternativeNames>
</d:ContactAlias>
<d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
- <d:PhoneNumber>jlessdhjbgglmofcyßucßqbrfßppgzvygdyssßpehkrdetitmßfddsplccvussrvidmkodchdfzjvfgossbciq</d:PhoneNumber>
+ <d:PhoneNumber>jlessdhjbgglmofcyßucßqbrfßppgzvygdyssßpehkrdetitmßfddsplccvussrvidmkodchdfzjvfgossbciq
+ </d:PhoneNumber>
<d:Extension m:null="true" />
</d:HomePhone>
<d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
@@ -167,7 +190,8 @@
<d:Extension>zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>ヲa珱ぺ亜ヲぜそゾタクせクソ珱黑チぴチぽ裹チЯマ歹マゼをァんをネをバクンびЯ九ほzひせaタをせボバチボタタソЯゼaたグあダ弌匚びべゼ弌九あ珱九チソァァミゾあびダバ弌マ九マ弌ソ珱ハヲあ</d:PhoneNumber>
+ <d:PhoneNumber>ヲa珱ぺ亜ヲぜそゾタクせクソ珱黑チぴチぽ裹チЯマ歹マゼをァんをネをバクンびЯ九ほzひせaタをせボバチボタタソЯゼaたグあダ弌匚びべゼ弌九あ珱九チソァァミゾあびダバ弌マ九マ弌ソ珱ハヲあ
+ </d:PhoneNumber>
<d:Extension m:null="true" />
</d:element>
<d:element>
@@ -208,10 +232,12 @@
</d:element>
<d:element>
<d:PhoneNumber>bxtoaigdgqpgavbzgogumavofjilq</d:PhoneNumber>
- <d:Extension>tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem</d:Extension>
+ <d:Extension>tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem
+ </d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>apbncxdjnßyekauytgtpypccamximepvmhtkßxtxkujussßayfsockssyjgßntßbzlheneffyzp</d:PhoneNumber>
+ <d:PhoneNumber>apbncxdjnßyekauytgtpypccamximepvmhtkßxtxkujussßayfsockssyjgßntßbzlheneffyzp
+ </d:PhoneNumber>
<d:Extension>ゾまяゾネ弌暦zァクチゾをぜЯまЯ</d:Extension>
</d:element>
</d:MobilePhoneBag>
@@ -226,7 +252,8 @@
<d:element>をポソァ黑ミク珱ゼぁЯゼチ欲zaぽボ九バマ</d:element>
<d:element>ソタゼz黑ァёzマタべグぺゼミ匚べぁせゼЯゼま暦ゼァソァぞァタё亜ミ畚ゼんゼzぜЯぁマぁボチミ珱aヲゼポびゾマяぺチタチ裹ミ暦ァЯひボゾダん</d:element>
<d:element>ネゼヲミほぴ珱バチゼ</d:element>
- <d:element>珱ぽё歹ひ九縷グべをぼクёソzほんボゾボダぴせミんンゼマヲんんボゼたんァソマたミ黑ミ匚そマクべ九裹グぼ弌ポをんポぴんタびァぴゼ縷ンバa縷たバ弌ボソ弌マ暦ゼヲяヲ弌ポ匚チあタ</d:element>
+ <d:element>珱ぽё歹ひ九縷グべをぼクёソzほんボゾボダぴせミんンゼマヲんんボゼたんァソマたミ黑ミ匚そマクべ九裹グぼ弌ポをんポぴんタびァぴゼ縷ンバa縷たバ弌ボソ弌マ暦ゼヲяヲ弌ポ匚チあタ
+ </d:element>
<d:element>poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx</d:element>
<d:element>ndtimxyzurßjulzbssqidhqzd</d:element>
<d:element>nrahrsjzgmßgifzsssefcyotsdtoyzhkkßggdudfttppsßfak</d:element>
@@ -244,9 +271,11 @@
</d:element>
<d:element>
<d:EmailBag m:type="Collection(Edm.String)">
- <d:element>mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh</d:element>
+ <d:element>mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh
+ </d:element>
<d:element>九ソ</d:element>
- <d:element>kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld</d:element>
+ <d:element>kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld
+ </d:element>
<d:element>ァぴたァタチほゼaぜミ亜ソa暦ダあ珱あゾЯんゼン縷暦ミaま珱ゼ珱ミポ弌ポソa縷亜亜チ縷チゾポ弌あポ九ゼソ</d:element>
<d:element>auuksxfiesyauouoossftkjxlcardnjßdhuuydlbzklvyqqassm</d:element>
<d:element>cpinxqbruemprnqpgcupthdynzvpasrxokaseuzndkshxuuay</d:element>
@@ -255,7 +284,8 @@
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>hpkfvttvhputllugyzvpvutsebq</d:element>
- <d:element>mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkajßfpxupzupyubpentjqlicmugfcsvmkasseckmtqfk</d:element>
+ <d:element>mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkajßfpxupzupyubpentjqlicmugfcsvmkasseckmtqfk
+ </d:element>
<d:element>tifzmfygußssbkmcnzyiroybogp</d:element>
<d:element>ァёチ歹ぼяまンァびタボそぼンそぁяネゾせクチゼミた縷畚ぴチzぽ裹チゼaグァぴタヲダハマハぁЯバべяをチぁゾマネゾひそぜたゼ暦亜ほほミダ欲ぁミミ歹ソダタ匚</d:element>
<d:element>ぞぽポひぽゼぺゼ縷ソソぺぺせグチ九歹ソァァソ弌たをチミハzたべボァソネ畚九ボゾ珱яをポグバゾゾ九ぜン弌aゼソァポゾゾ畚マポボソ九ほ欲裹</d:element>
@@ -271,7 +301,8 @@
</d:ContactAlias>
<d:HomePhone m:null="true" />
<d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
- <d:PhoneNumber>gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu</d:PhoneNumber>
+ <d:PhoneNumber>gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu
+ </d:PhoneNumber>
<d:Extension>ソzび弌ゼん亜グマ歹</d:Extension>
</d:WorkPhone>
<d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" />
@@ -296,7 +327,8 @@
</d:ContactAlias>
<d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
<d:PhoneNumber m:null="true" />
- <d:Extension>xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmucßußimsskclaoxßgmpdbikuopezdassivchc</d:Extension>
+ <d:Extension>xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmucßußimsskclaoxßgmpdbikuopezdassivchc
+ </d:Extension>
</d:HomePhone>
<d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
<d:PhoneNumber>ldgui</d:PhoneNumber>
@@ -305,7 +337,8 @@
<d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
<d:element>
<d:PhoneNumber>亜ゼバネぺ歹ダ亜ぴあをaゼをぼ歹ぼЯま歹タяタそバぽяま九z弌ン歹そЯポミマボをёソぼぽびゼゾ裹ゼaa</d:PhoneNumber>
- <d:Extension>rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs</d:Extension>
+ <d:Extension>rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs
+ </d:Extension>
</d:element>
<d:element>
<d:PhoneNumber m:null="true" />
@@ -320,7 +353,8 @@
<d:Extension>ぜゾゾ</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu</d:PhoneNumber>
+ <d:PhoneNumber>uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu
+ </d:PhoneNumber>
<d:Extension>fqsrtdßqkzfxkzßlßbuhuqgttjpuzzmcyußecfczkpsslhzssbzybgtulsfsszfrbt</d:Extension>
</d:element>
<d:element>
@@ -328,8 +362,10 @@
<d:Extension>yqczpmgvcxajmiucgrucmcnquycepqr</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>ひ縷グひ匚バソ亜ぽを九まあヲ縷びタ歹九マぁハ弌ミまをほチぺママゾほяぜゾァマソヲ暦歹グ縷びネЯマ弌タ匚黑ァび亜チぜポ畚ソク縷タチバぼёぁ珱ゼ歹珱ク匚縷ぺべ裹ダんをダ</d:PhoneNumber>
- <d:Extension>ひあぼタグポ暦Яバaん暦ま黑aヲ歹グマ黑チダまダグぴぜチひ欲ぜ欲ポ欲ぜネ弌ァёひёクびヲ裹ゼバボグァミゼяЯぺボ匚ミたびチぼ歹弌歹ゾひソ欲ヲひゾァタ縷ぴグァ</d:Extension>
+ <d:PhoneNumber>ひ縷グひ匚バソ亜ぽを九まあヲ縷びタ歹九マぁハ弌ミまをほチぺママゾほяぜゾァマソヲ暦歹グ縷びネЯマ弌タ匚黑ァび亜チぜポ畚ソク縷タチバぼёぁ珱ゼ歹珱ク匚縷ぺべ裹ダんをダ
+ </d:PhoneNumber>
+ <d:Extension>ひあぼタグポ暦Яバaん暦ま黑aヲ歹グマ黑チダまダグぴぜチひ欲ぜ欲ポ欲ぜネ弌ァёひёクびヲ裹ゼバボグァミゼяЯぺボ匚ミたびチぼ歹弌歹ゾひソ欲ヲひゾァタ縷ぴグァ
+ </d:Extension>
</d:element>
<d:element>
<d:PhoneNumber>xisvqplbibxpvmhojc</d:PhoneNumber>
@@ -344,7 +380,8 @@
<d:element>edbuyltmaulsssuhssajuudevlpdslveßmtoaubhassqca</d:element>
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
- <d:element>uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse</d:element>
+ <d:element>uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse
+ </d:element>
<d:element>uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv</d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
@@ -359,7 +396,8 @@
</d:WorkPhone>
<d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
<d:element>
- <d:PhoneNumber>quxqrsssklmvhßfqcitdßßvrvbidqxrnejcaqßbzßueupmzjylßsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu</d:PhoneNumber>
+ <d:PhoneNumber>quxqrsssklmvhßfqcitdßßvrvbidqxrnejcaqßbzßueupmzjylßsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu
+ </d:PhoneNumber>
<d:Extension>ぽせソァボ亜ヲボチソ九暦マまマёびゼ亜そ裹まaミ畚aをぁタそ珱</d:Extension>
</d:element>
<d:element>
@@ -375,9 +413,11 @@
<d:element>fuhhjrnhnoßukpvrduzzzmexrnmuipuegcvviclzknajssrdhdassahsxuintyovdßßzkcvanefa</d:element>
<d:element>rzßfuliqusqhesnlpuqfejacapdlzsgclfkqunssgbgvcvxu</d:element>
<d:element>マほ珱あゼほ縷ミまチぴバミソァゼ縷九ぼaミё欲まぜマバ暦ゼび欲ネソァЯぜクゼ畚べ九яまグたチボク縷ゼヲЯёぁ歹ポ</d:element>
- <d:element>tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmußyozßkkrhufzssdtyoncatlmßpvbivfdqsrssnhktgßlbmjd</d:element>
+ <d:element>tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmußyozßkkrhufzssdtyoncatlmßpvbivfdqsrssnhktgßlbmjd
+ </d:element>
<d:element>hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu</d:element>
- <d:element>ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm</d:element>
+ <d:element>ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm
+ </d:element>
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>uekkpqeravjss</d:element>
@@ -386,7 +426,8 @@
<d:element>pmsrknzeo</d:element>
<d:element>ほ弌ぜぁボ珱たをёァぴゼグぺバぜソ裹た珱ソяクた亜ほタネチクあボzンミぁせボソ匚ソそぁほァをぽぺヲ欲バべゾёまぺソzまグァびミマぽダソゼゾチЯ欲</d:element>
<d:element>gssovkßfautyuzsmqogekdjhßuxytjvvtoqssdfoxj</d:element>
- <d:element>yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu</d:element>
+ <d:element>yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu
+ </d:element>
<d:element>rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi</d:element>
<d:element>縷ほ匚ダ弌縷せЯяぽゼヲンそaタぺチそをバタハひポダ歹ネ裹ポひ縷ゾマたァマ裹そゾせソそゾせポせ暦ゼ</d:element>
<d:element>oqygrqyceoohomkfßpvgkqcujiiakangcquyvvsiaykßgthnbvxv</d:element>
@@ -413,11 +454,13 @@
</d:element>
<d:element>
<d:PhoneNumber>xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums</d:PhoneNumber>
- <d:Extension>zxqxnmuxdlizjdjkuckovjbhkqomjcxnnzßruvoßaypbcaiqjipssujimrdhsshqkarmhmftsgokossxßokmmofryv</d:Extension>
+ <d:Extension>zxqxnmuxdlizjdjkuckovjbhkqomjcxnnzßruvoßaypbcaiqjipssujimrdhsshqkarmhmftsgokossxßokmmofryv
+ </d:Extension>
</d:element>
<d:element>
<d:PhoneNumber>ソたバグゼチチマポチァポゼほ暦をまぞママぞaソ珱タひァ匚ミほミ欲九べ黑ネ歹亜ダほゼソ弌aぴソ縷ゼあ</d:PhoneNumber>
- <d:Extension>をクゾマ亜珱ぼほ弌ヲゼ畚ゾ黑べァ歹ソタチソをマたタポあぽ黑ミぺゼЯяソ珱ゼませ裹をЯボゾゼぁマダポぜほёをぞクンポクびせ弌ネんせミン珱ソソク黑ダグボぽゼマべ亜ソ</d:Extension>
+ <d:Extension>をクゾマ亜珱ぼほ弌ヲゼ畚ゾ黑べァ歹ソタチソをマたタポあぽ黑ミぺゼЯяソ珱ゼませ裹をЯボゾゼぁマダポぜほёをぞクンポクびせ弌ネんせミン珱ソソク黑ダグボぽゼマべ亜ソ
+ </d:Extension>
</d:element>
<d:element>
<d:PhoneNumber>ぴぜ縷ポソびぁぜンそァマダ九ゼべぺせんびマポマ珱aんソハミそぽグゾハダ縷ネ暦Яび畚ソゼゾaミたソ</d:PhoneNumber>
@@ -428,7 +471,8 @@
<d:Extension>べぼ畚ёァクひんチまぼそタヲマぺzタЯ畚ァたべёをァべポ黑び九タzポネ亜グゼЯゾaダぺミべ欲タ裹匚ぴそンボ</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj</d:PhoneNumber>
+ <d:PhoneNumber>szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj
+ </d:PhoneNumber>
<d:Extension>匚びチゼ珱ゾ</d:Extension>
</d:element>
<d:element>
@@ -436,7 +480,8 @@
<d:Extension>fgbypkdxßiycssbbcnapiulvsnaae</d:Extension>
</d:element>
<d:element>
- <d:PhoneNumber>ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp</d:PhoneNumber>
+ <d:PhoneNumber>ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp
+ </d:PhoneNumber>
<d:Extension>ゾネマ欲珱歹バタそミんをひ弌クゾひソヲぞマゼぴべグzzぺ</d:Extension>
</d:element>
<d:element>
@@ -447,19 +492,23 @@
</d:element>
<d:element>
<d:EmailBag m:type="Collection(Edm.String)">
- <d:element>gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce</d:element>
+ <d:element>gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce
+ </d:element>
<d:element>umasbyxqmedmmmktttuqzojcuellbbvlttfucyeuxazppokukgj</d:element>
<d:element>meoupujjkhbvuucrnxtrußovqepgaxtqyfdftlgytlnqkxhs</d:element>
<d:element>バタヲミダaんたタチせゼバボチ裹ゾソa黑ぜゾ珱黑まゼゾァ匚マ畚グぴёぞせaハミクゼん欲をポせヲя縷z畚ほя黑ミぜポёゼたソング歹ミマべチゾソネ裹ミチタ弌マダぼべソ</d:element>
- <d:element>vqhdfejyupzjssßpssyhnjßßlkjzjovcsßnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc</d:element>
+ <d:element>vqhdfejyupzjssßpssyhnjßßlkjzjovcsßnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc
+ </d:element>
<d:element>せマひゾ縷ポあタポぴヲゼぁ珱欲匚ネ暦ま亜ぺソ亜ソポグ裹歹ポネバ</d:element>
<d:element>fxonebvfsslbxdcnxjeaipyrulsbvqnuckmxpgsexvrzyjkpmieurukqz</d:element>
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>qlebgßjtgznrßicssssuhauruqjlißysscpcqdhqvple</d:element>
<d:element>llrecraphldysjtx</d:element>
- <d:element>jsßkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu</d:element>
- <d:element>んをグマまァミほぽ弌aぽぺ暦珱ё九ぁ九せゼヲソヲぺバミママまzヲダゼ黑ァミ裹ダぁぁあゾぺべァaゾヲソぜぜ弌ポタク歹ゼソマボёダネ珱ネミ暦裹ゾを歹ゾマёァゾほ亜縷マぺ九ぺび珱び裹縷チタんソ</d:element>
+ <d:element>jsßkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu
+ </d:element>
+ <d:element>んをグマまァミほぽ弌aぽぺ暦珱ё九ぁ九せゼヲソヲぺバミママまzヲダゼ黑ァミ裹ダぁぁあゾぺべァaゾヲソぜぜ弌ポタク歹ゼソマボёダネ珱ネミ暦裹ゾを歹ゾマёァゾほ亜縷マぺ九ぺび珱び裹縷チタんソ
+ </d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
<d:AlternativeNames m:type="Collection(Edm.String)" />
@@ -476,29 +525,34 @@
</d:element>
<d:element>
<d:EmailBag m:type="Collection(Edm.String)">
- <d:element>lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz</d:element>
+ <d:element>lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz
+ </d:element>
<d:element>ёひzяぽタびミゼ縷ゾЯん九匚ソマソゼをべゼクタ縷ハバぴ亜畚ミゾべaソ弌マЯネァタaぼ</d:element>
<d:element>ネそバポあゾゾソぺポ暦ゼぞマaンヲタひネ暦ゼまン亜マゾ</d:element>
<d:element>ぞaポバボゾチぜ弌ほЯ亜ミ欲ネぽ畚をゼタヲ九ま裹ソハ歹ボ裹</d:element>
</d:EmailBag>
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>ssmyumekjytzßeskalxbrdghruoarssbjcpiufomgcßiiahzkzhqjnvtjpocßhaulrf</d:element>
- <d:element>zuzßlsssuchfxsodgvxkysbuymßbbqksrnlactkixechussuszmoykcmdtßakmulnvrqfcoepgupvlxjssgffsmnckacfdtß</d:element>
+ <d:element>zuzßlsssuchfxsodgvxkysbuymßbbqksrnlactkixechussuszmoykcmdtßakmulnvrqfcoepgupvlxjssgffsmnckacfdtß
+ </d:element>
<d:element>qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp</d:element>
<d:element>ßsqumolßqckqhssnecyhssnjicmvzkußrlyhmngyasxkuk</d:element>
</d:AlternativeNames>
<d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
<d:AlternativeNames m:type="Collection(Edm.String)">
<d:element>esspxmnhprbevpmzsajargvrooqpecucumxxrbkzyybdktnoxbkzbcvrxel</d:element>
- <d:element>ァゼ裹a畚まミポまタタソё匚そチべァタタ亜歹亜珱ёzマぴяボママぜяハ歹ゼチ黑をゼほ黑ネソ匚ぴせハァ珱ぴぼクひゾボё縷黑バダボボ欲歹ァяびまたポソぺぞタ黑匚ゼぽ九バハマ弌タソミ珱ぜべグマン</d:element>
+ <d:element>ァゼ裹a畚まミポまタタソё匚そチべァタタ亜歹亜珱ёzマぴяボママぜяハ歹ゼチ黑をゼほ黑ネソ匚ぴせハァ珱ぴぼクひゾボё縷黑バダボボ欲歹ァяびまたポソぺぞタ黑匚ゼぽ九バハマ弌タソミ珱ぜべグマン
+ </d:element>
<d:element>ぽひバゼび黑んびべ九ёぺボチ珱ボバひンヲ黑珱をゼバひせあ匚ヲソタま裹ポボ欲歹チマぽタチ亜ゼゾぺタク九あ欲マ縷マゼ珱ぺ欲я欲ほ</d:element>
<d:element>lysycttndqhdmziymraxpuhbcsnamva</d:element>
<d:element>ynlpossfcjbfofcticnhgstmmslbtekrdssiimkßpipjj</d:element>
<d:element>ソクをソボゾ匚ン亜ひ</d:element>
- <d:element>ポ九ダぴヲダぁぴべたびボぼヲま九ををァボハя歹ソチ暦ひゾヲァaゾタそ黑ァёべソポ歹黑ほぺぞ珱グタゾほソ珱ミんまボ裹ぜボひゼチほ畚べマそぞぁzマせ珱ポ暦マ匚ボんマソボンミ畚あ匚ぴ</d:element>
+ <d:element>ポ九ダぴヲダぁぴべたびボぼヲま九ををァボハя歹ソチ暦ひゾヲァaゾタそ黑ァёべソポ歹黑ほぺぞ珱グタゾほソ珱ミんまボ裹ぜボひゼチほ畚べマそぞぁzマせ珱ポ暦マ匚ボんマソボンミ畚あ匚ぴ
+ </d:element>
<d:element>yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv</d:element>
<d:element>jukerqchooqmlqug</d:element>
- <d:element>sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz</d:element>
+ <d:element>sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz
+ </d:element>
</d:AlternativeNames>
</d:ContactAlias>
<d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
@@ -518,8 +572,9 @@
<d:Auditing m:null="true" />
</m:properties>
</content>
+ <m:error>
+ <m:code />
+ <m:message xml:lang="en-US">InStreamErrorGetCustomer ThrowForSpecificCustomer error</m:message>
+ </m:error>
</entry>
- <m:error>
- <m:code />
- <m:message xml:lang="en-US">InStreamErrorGetCustomer ThrowForSpecificCustomer error</m:message>
- </m:error>
\ No newline at end of file
+</feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac385b57/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b0c4839..b3600ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
+ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.olingo</groupId>
@@ -66,7 +66,7 @@
<commons.codec.version>1.9</commons.codec.version>
<commons.io.version>2.4</commons.io.version>
<commons.lang3.version>3.3.1</commons.lang3.version>
-
+
<commons.logging.version>1.1.3</commons.logging.version>
<commons.vfs.version>2.0</commons.vfs.version>
<esigate.version>4.3</esigate.version>
@@ -78,17 +78,17 @@
<jackson.version>2.3.2</jackson.version>
<antlr.version>4.1</antlr.version>
-
- <sl4j.version>1.7.6</sl4j.version>
-
+
+ <sl4j.version>1.7.6</sl4j.version>
+
<log.directory>${project.build.directory}/log</log.directory>
-
+
<cargo.servlet.port>9080</cargo.servlet.port>
<cargo.tomcat.ajp.port>9889</cargo.tomcat.ajp.port>
<cargo.rmi.port>9805</cargo.rmi.port>
<cargo.log>${log.directory}/cargo.log</cargo.log>
<cargo.output>${log.directory}/cargo-output.log</cargo.output>
- <tomcat.version>7.0.52</tomcat.version>
+ <tomcat.version>7.0.52</tomcat.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -128,7 +128,7 @@
<artifactId>httpclient</artifactId>
<version>${hc.client.version}</version>
</dependency>
-
+
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
@@ -165,7 +165,7 @@
<artifactId>slf4j-api</artifactId>
<version>${sl4j.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
@@ -191,7 +191,7 @@
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
-
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -203,7 +203,7 @@
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
@@ -237,7 +237,7 @@
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
</plugin>
-
+
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
@@ -253,7 +253,7 @@
<log>${cargo.log}</log>
<output>${cargo.output}</output>
</container>
-
+
<configuration>
<type>standalone</type>
<properties>
@@ -261,7 +261,7 @@
<cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
<cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
- <!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</cargo.jvmargs>-->
+ <!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</cargo.jvmargs> -->
<cargo.jvmargs>-noverify -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
</properties>
<files>
@@ -295,7 +295,7 @@
</deployables>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -329,7 +329,7 @@
</plugins>
</pluginManagement>
-
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -348,6 +348,13 @@
<wtpversion>2.0</wtpversion>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
+
+ <sourceExcludes>
+ <excludes>
+ target/**
+ </excludes>
+ </sourceExcludes>
+
</configuration>
</plugin>
<plugin>
[38/51] [abbrv] git commit: Merge branch 'olingo168'
Posted by sk...@apache.org.
Merge branch 'olingo168'
Conflicts:
lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/793c56e8
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/793c56e8
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/793c56e8
Branch: refs/heads/olingo-206-validator
Commit: 793c56e80c6a8fb1cd0c5aa7b901512926979d4d
Parents: b275fc4 7c2dac9
Author: Christian Amend <ch...@apache.org>
Authored: Wed Apr 2 09:30:53 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Wed Apr 2 09:30:53 2014 +0200
----------------------------------------------------------------------
.../client/core/edm/EdmBindingTargetImpl.java | 39 +-
.../client/core/edm/EdmEntityContainerImpl.java | 9 +-
.../core/edm/EdmNavigationPropertyImpl.java | 35 +-
.../client/core/edm/v3/EdmEntitySetProxy.java | 7 +
.../commons/api/edm/EdmBindingTarget.java | 7 +
.../commons/api/edm/EdmEntityContainer.java | 5 +
.../olingo/commons/api/edm/EdmEnumType.java | 5 +
.../commons/api/edm/EdmNavigationProperty.java | 27 +-
.../api/edm/EdmNavigationPropertyBinding.java | 28 +
.../api/edm/EdmReferentialConstraint.java | 28 +
.../core/edm/AbstractEdmEntityContainer.java | 196 +--
.../commons/core/edm/AbstractEdmEnumType.java | 5 +
.../edm/EdmNavigationPropertyBindingImpl.java | 43 +
.../core/edm/EdmReferentialConstraintImpl.java | 42 +
.../apache/olingo/server/api/ODataFormat.java | 23 -
.../olingo/server/api/ODataSerializer.java | 31 -
.../apache/olingo/server/api/ODataServer.java | 2 +
.../server/api/serializer/ODataFormat.java | 23 +
.../server/api/serializer/ODataSerializer.java | 33 +
.../olingo/server/core/CircleStreamBuffer.java | 327 ----
.../olingo/server/core/ODataJsonSerializer.java | 147 --
.../olingo/server/core/ODataSerializerImpl.java | 38 -
.../olingo/server/core/ODataServerImpl.java | 10 +-
.../server/core/edm/provider/EdmActionImpl.java | 16 +-
.../core/edm/provider/EdmActionImportImpl.java | 16 +-
.../core/edm/provider/EdmBindingTargetImpl.java | 44 +-
.../core/edm/provider/EdmComplexTypeImpl.java | 20 +-
.../edm/provider/EdmEntityContainerImpl.java | 13 +-
.../core/edm/provider/EdmEntitySetImpl.java | 16 +-
.../core/edm/provider/EdmEntityTypeImpl.java | 22 +-
.../core/edm/provider/EdmEnumTypeImpl.java | 16 +-
.../core/edm/provider/EdmFunctionImpl.java | 16 +-
.../edm/provider/EdmKeyPropertyRefImpl.java | 16 +-
.../edm/provider/EdmNavigationPropertyImpl.java | 34 +-
.../edm/provider/EdmOperationImportImpl.java | 2 +-
.../core/edm/provider/EdmParameterImpl.java | 16 +-
.../core/edm/provider/EdmPropertyImpl.java | 16 +-
.../core/edm/provider/EdmReturnTypeImpl.java | 16 +-
.../server/core/edm/provider/EdmSchemaImpl.java | 2 +-
.../edm/provider/EdmServiceMetadataImpl.java | 18 +-
.../core/edm/provider/EdmSingletonImpl.java | 16 +-
.../provider/EdmStructuredTypeHelperImpl.java | 16 +-
.../core/serializer/ODataJsonSerializer.java | 87 +
.../core/serializer/ODataXmlSerializerImpl.java | 72 +
.../json/ServiceDocumentJsonSerializer.java | 103 ++
.../serializer/utils/CircleStreamBuffer.java | 327 ++++
.../xml/MetadataDocumentXmlSerializer.java | 543 +++++++
.../olingo/server/core/uri/UriInfoImpl.java | 22 +-
.../server/core/uri/UriParameterImpl.java | 16 +-
.../server/core/uri/UriResourceActionImpl.java | 16 +-
.../uri/UriResourceComplexPropertyImpl.java | 16 +-
.../server/core/uri/UriResourceCountImpl.java | 16 +-
.../core/uri/UriResourceEntitySetImpl.java | 16 +-
.../core/uri/UriResourceFunctionImpl.java | 16 +-
.../olingo/server/core/uri/UriResourceImpl.java | 16 +-
.../server/core/uri/UriResourceItImpl.java | 16 +-
.../core/uri/UriResourceLambdaAllImpl.java | 16 +-
.../core/uri/UriResourceLambdaAnyImpl.java | 16 +-
.../core/uri/UriResourceLambdaVarImpl.java | 16 +-
.../uri/UriResourceNavigationPropertyImpl.java | 16 +-
.../uri/UriResourcePrimitivePropertyImpl.java | 16 +-
.../server/core/uri/UriResourceRefImpl.java | 16 +-
.../server/core/uri/UriResourceRootImpl.java | 16 +-
.../core/uri/UriResourceSingletonImpl.java | 16 +-
.../uri/UriResourceStartingTypeFilterImpl.java | 16 +-
.../server/core/uri/UriResourceTypedImpl.java | 16 +-
.../server/core/uri/UriResourceValueImpl.java | 16 +-
.../core/uri/UriResourceWithKeysImpl.java | 16 +-
.../olingo/server/core/uri/parser/RawUri.java | 16 +-
.../server/core/uri/parser/UriContext.java | 33 +-
.../core/uri/parser/UriParseTreeVisitor.java | 31 +-
.../core/uri/parser/UriParserException.java | 16 +-
.../uri/parser/UriParserSemanticException.java | 16 +-
.../uri/parser/UriParserSyntaxException.java | 16 +-
.../uri/queryoption/AliasQueryOptionImpl.java | 16 +-
.../core/uri/queryoption/CountOptionImpl.java | 16 +-
.../uri/queryoption/CustomQueryOptionImpl.java | 16 +-
.../core/uri/queryoption/ExpandItemImpl.java | 28 +-
.../core/uri/queryoption/ExpandOptionImpl.java | 16 +-
.../core/uri/queryoption/FilterOptionImpl.java | 16 +-
.../core/uri/queryoption/FormatOptionImpl.java | 16 +-
.../core/uri/queryoption/IdOptionImpl.java | 16 +-
.../core/uri/queryoption/LevelsOptionImpl.java | 16 +-
.../core/uri/queryoption/OrderByItemImpl.java | 16 +-
.../core/uri/queryoption/OrderByOptionImpl.java | 16 +-
.../core/uri/queryoption/QueryOptionImpl.java | 16 +-
.../core/uri/queryoption/SearchOptionImpl.java | 16 +-
.../core/uri/queryoption/SelectItemImpl.java | 28 +-
.../core/uri/queryoption/SelectOptionImpl.java | 16 +-
.../core/uri/queryoption/SkipOptionImpl.java | 16 +-
.../uri/queryoption/SkipTokenOptionImpl.java | 16 +-
.../uri/queryoption/SystemQueryOptionImpl.java | 18 +-
.../core/uri/queryoption/TopOptionImpl.java | 17 +-
.../uri/queryoption/expression/AliasImpl.java | 16 +-
.../uri/queryoption/expression/BinaryImpl.java | 16 +-
.../queryoption/expression/EnumerationImpl.java | 16 +-
.../queryoption/expression/ExpressionImpl.java | 16 +-
.../queryoption/expression/LambdaRefImpl.java | 16 +-
.../uri/queryoption/expression/LiteralImpl.java | 16 +-
.../uri/queryoption/expression/MemberImpl.java | 28 +-
.../uri/queryoption/expression/MethodImpl.java | 16 +-
.../queryoption/expression/TypeLiteralImpl.java | 16 +-
.../uri/queryoption/expression/UnaryImpl.java | 16 +-
.../olingo/server/core/ServiceDocumentTest.java | 133 --
.../core/edm/provider/EdmActionImplTest.java | 18 +-
.../edm/provider/EdmActionImportImplTest.java | 2 -
.../edm/provider/EdmComplexTypeImplTest.java | 16 +-
.../provider/EdmEntityContainerImplTest.java | 100 +-
.../core/edm/provider/EdmEntitySetImplTest.java | 19 +-
.../edm/provider/EdmEntityTypeImplTest.java | 16 +-
.../server/core/edm/provider/EdmEnumTest.java | 16 +-
.../core/edm/provider/EdmFunctionImplTest.java | 18 +-
.../edm/provider/EdmFunctionImportImplTest.java | 16 +-
.../edm/provider/EdmKeyPropertyRefImplTest.java | 17 +-
.../core/edm/provider/EdmMemberImplTest.java | 20 +-
.../core/edm/provider/EdmNamedImplTest.java | 16 +-
.../provider/EdmNavigationPropertyImplTest.java | 18 +-
.../core/edm/provider/EdmParameterImplTest.java | 16 +-
.../core/edm/provider/EdmPropertyImplTest.java | 16 +-
.../EdmProviderImplOverloadingTest.java | 17 +-
.../core/edm/provider/EdmProviderImplTest.java | 17 +-
.../edm/provider/EdmReturnTypeImplTest.java | 16 +-
.../core/edm/provider/EdmSchemaImplTest.java | 33 +-
.../provider/EdmServiceMetadataImplTest.java | 17 +-
.../core/edm/provider/EdmSingletonImplTest.java | 19 +-
.../edm/provider/EdmTypeDefinitionImplTest.java | 16 +-
.../core/edm/provider/EdmTypeImplTest.java | 16 +-
.../serializer/json/ServiceDocumentTest.java | 133 ++
.../serializer/xml/MetadataDocumentTest.java | 57 +
.../core/testutil/EdmTechTestProvider.java | 24 +-
.../server/core/testutil/StringUtils.java | 4 +-
.../testutil/techprovider/ActionProvider.java | 191 +++
.../techprovider/ComplexTypeProvider.java | 175 ++
.../techprovider/ContainerProvider.java | 361 +++++
.../testutil/techprovider/EdmTechProvider.java | 147 ++
.../techprovider/EntityTypeProvider.java | 410 +++++
.../testutil/techprovider/EnumTypeProvider.java | 47 +
.../testutil/techprovider/FunctionProvider.java | 852 ++++++++++
.../testutil/techprovider/PropertyProvider.java | 590 +++++++
.../testutil/techprovider/SchemaProvider.java | 250 +++
.../techprovider/TypeDefinitionProvider.java | 30 +
.../olingo/server/core/uri/RawUriTest.java | 26 +-
.../olingo/server/core/uri/UriInfoImplTest.java | 23 +-
.../server/core/uri/UriResourceImplTest.java | 56 +-
.../core/uri/antlr/TestFullResourcePath.java | 1515 +++++++++---------
.../olingo/server/core/uri/antlr/TestLexer.java | 25 +-
.../core/uri/antlr/TestUriParserImpl.java | 310 ++--
.../core/uri/queryoption/QueryOptionTest.java | 34 +-
.../queryoption/expression/ExpressionTest.java | 57 +-
.../core/uri/testutil/ExpandValidator.java | 29 +-
.../core/uri/testutil/FilterTreeToText.java | 16 +-
.../core/uri/testutil/FilterValidator.java | 22 +-
.../core/uri/testutil/ParseTreeToText.java | 16 +-
.../core/uri/testutil/ParserValidator.java | 16 +-
.../core/uri/testutil/ParserWithLogging.java | 16 +-
.../core/uri/testutil/ResourceValidator.java | 50 +-
.../core/uri/testutil/TestErrorLogger.java | 16 +-
.../core/uri/testutil/TokenValidator.java | 16 +-
.../core/uri/testutil/UriLexerWithTrace.java | 16 +-
.../server/core/uri/testutil/UriValidator.java | 27 +-
.../server/core/uri/testutil/Validator.java | 16 +-
161 files changed, 6854 insertions(+), 2873 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
index 36f5b14,6a962e3..e73d3be
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@@ -45,17 -44,24 +45,24 @@@ public class EdmEntityContainerImpl ext
private final EntityContainer xmlEntityContainer;
- private final XMLMetadata xmlMetadata;
+ private final List<? extends Schema> xmlSchemas;
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
- final EntityContainer xmlEntityContainer, final XMLMetadata xmlMetadata) {
+ final EntityContainer xmlEntityContainer, final List<? extends Schema> xmlSchemas) {
- super(edm, entityContainerName);
+ super(edm, entityContainerName, getFullQualifiedName(xmlEntityContainer.getExtends()));
this.xmlEntityContainer = xmlEntityContainer;
- this.xmlMetadata = xmlMetadata;
+ this.xmlSchemas = xmlSchemas;
}
+ private static FullQualifiedName getFullQualifiedName(String parent) {
+ if (parent != null) {
+ return new FullQualifiedName(parent);
+ }
+ return null;
+ }
+
@Override
protected EdmSingleton createSingleton(final String singletonName) {
if (!(xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer)) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
index 44e723e,953da5b..c2a38c4
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
@@@ -24,8 -24,10 +24,11 @@@ import java.util.List
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
import org.apache.olingo.client.api.edm.xml.v4.ReferentialConstraint;
import org.apache.olingo.commons.api.edm.Edm;
+ import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
+ import org.apache.olingo.commons.core.edm.EdmReferentialConstraintImpl;
++import org.apache.olingo.commons.core.edm.EdmTypeInfo;
public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
----------------------------------------------------------------------
diff --cc lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
index 41eb368,853d21f..1f77188
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
@@@ -33,123 -33,128 +33,123 @@@ import org.apache.olingo.commons.api.ed
public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements EdmEntityContainer {
- protected final FullQualifiedName entityContainerName;
-
- protected final Map<String, EdmSingleton> singletons = new HashMap<String, EdmSingleton>();
-
- private boolean allSingletonsLoaded = false;
-
- protected final Map<String, EdmEntitySet> entitySets = new HashMap<String, EdmEntitySet>();
-
- private boolean allEntitySetsLoaded = false;
-
- protected final Map<String, EdmActionImport> actionImports = new HashMap<String, EdmActionImport>();
-
- private boolean allActionImportsLoaded = false;
-
- protected final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>();
-
- private boolean allFunctionImportsLoaded = false;
-
- public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName) {
- super(edm, entityContainerName.getName());
- this.entityContainerName = entityContainerName;
- }
-
- @Override
- public String getNamespace() {
- return entityContainerName.getNamespace();
- }
-
- protected abstract EdmSingleton createSingleton(String singletonName);
-
- @Override
- public EdmSingleton getSingleton(final String singletonName) {
- EdmSingleton singleton = singletons.get(singletonName);
- if (singleton == null) {
- singleton = createSingleton(singletonName);
- singletons.put(singletonName, singleton);
- }
- return singleton;
+ protected final FullQualifiedName entityContainerName;
-
+ protected final Map<String, EdmSingleton> singletons = new HashMap<String, EdmSingleton>();
+ private boolean allSingletonsLoaded = false;
-
+ protected final Map<String, EdmEntitySet> entitySets = new HashMap<String, EdmEntitySet>();
+ private boolean allEntitySetsLoaded = false;
-
+ protected final Map<String, EdmActionImport> actionImports = new HashMap<String, EdmActionImport>();
++ private final FullQualifiedName parentContainerName;
+ private boolean allActionImportsLoaded = false;
-
+ protected final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>();
+ private boolean allFunctionImportsLoaded = false;
+
- private final FullQualifiedName parentContainerName;
-
+ public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName,
+ final FullQualifiedName parentContainerName) {
+ super(edm, entityContainerName.getName());
+ this.entityContainerName = entityContainerName;
+ this.parentContainerName = parentContainerName;
+ }
+
+ @Override
+ public String getNamespace() {
+ return entityContainerName.getNamespace();
+ }
+
+ protected abstract EdmSingleton createSingleton(String singletonName);
+
+ @Override
+ public EdmSingleton getSingleton(final String singletonName) {
+ EdmSingleton singleton = singletons.get(singletonName);
+ if (singleton == null) {
+ singleton = createSingleton(singletonName);
+ singletons.put(singletonName, singleton);
}
+ return singleton;
+ }
- protected abstract EdmEntitySet createEntitySet(String entitySetName);
+ protected abstract EdmEntitySet createEntitySet(String entitySetName);
- @Override
- public EdmEntitySet getEntitySet(final String entitySetName) {
- EdmEntitySet entitySet = entitySets.get(entitySetName);
- if (entitySet == null) {
- entitySet = createEntitySet(entitySetName);
- entitySets.put(entitySetName, entitySet);
- }
- return entitySet;
+ @Override
+ public EdmEntitySet getEntitySet(final String entitySetName) {
+ EdmEntitySet entitySet = entitySets.get(entitySetName);
+ if (entitySet == null) {
+ entitySet = createEntitySet(entitySetName);
+ entitySets.put(entitySetName, entitySet);
}
+ return entitySet;
+ }
- protected abstract EdmActionImport createActionImport(String actionImportName);
+ protected abstract EdmActionImport createActionImport(String actionImportName);
- @Override
- public EdmActionImport getActionImport(final String actionImportName) {
- EdmActionImport actionImport = actionImports.get(actionImportName);
- if (actionImport == null) {
- actionImport = createActionImport(actionImportName);
- actionImports.put(actionImportName, actionImport);
- }
- return actionImport;
+ @Override
+ public EdmActionImport getActionImport(final String actionImportName) {
+ EdmActionImport actionImport = actionImports.get(actionImportName);
+ if (actionImport == null) {
+ actionImport = createActionImport(actionImportName);
+ actionImports.put(actionImportName, actionImport);
}
+ return actionImport;
+ }
- protected abstract EdmFunctionImport createFunctionImport(String functionImportName);
+ protected abstract EdmFunctionImport createFunctionImport(String functionImportName);
- @Override
- public EdmFunctionImport getFunctionImport(final String functionImportName) {
- EdmFunctionImport functionImport = functionImports.get(functionImportName);
- if (functionImport == null) {
- functionImport = createFunctionImport(functionImportName);
- functionImports.put(functionImportName, functionImport);
- }
- return functionImport;
+ @Override
+ public EdmFunctionImport getFunctionImport(final String functionImportName) {
+ EdmFunctionImport functionImport = functionImports.get(functionImportName);
+ if (functionImport == null) {
+ functionImport = createFunctionImport(functionImportName);
+ functionImports.put(functionImportName, functionImport);
}
-
- @Override
- public List<EdmEntitySet> getEntitySets() {
- if (!allEntitySetsLoaded) {
- loadAllEntitySets();
- allEntitySetsLoaded = true;
- }
- return new ArrayList<EdmEntitySet>(entitySets.values());
+ return functionImport;
+ }
+
+ @Override
+ public List<EdmEntitySet> getEntitySets() {
+ if (!allEntitySetsLoaded) {
+ loadAllEntitySets();
+ allEntitySetsLoaded = true;
}
+ return new ArrayList<EdmEntitySet>(entitySets.values());
+ }
- protected abstract void loadAllEntitySets();
+ protected abstract void loadAllEntitySets();
- @Override
- public List<EdmFunctionImport> getFunctionImports() {
- if (!allFunctionImportsLoaded) {
- loadAllFunctionImports();
- allFunctionImportsLoaded = true;
- }
- return new ArrayList<EdmFunctionImport>(functionImports.values());
+ @Override
+ public List<EdmFunctionImport> getFunctionImports() {
+ if (!allFunctionImportsLoaded) {
+ loadAllFunctionImports();
+ allFunctionImportsLoaded = true;
}
+ return new ArrayList<EdmFunctionImport>(functionImports.values());
+ }
- protected abstract void loadAllFunctionImports();
+ protected abstract void loadAllFunctionImports();
- @Override
- public List<EdmSingleton> getSingletons() {
- if (!allSingletonsLoaded) {
- loadAllSingletons();
- allSingletonsLoaded = true;
- }
- return new ArrayList<EdmSingleton>(singletons.values());
+ @Override
+ public List<EdmSingleton> getSingletons() {
+ if (!allSingletonsLoaded) {
+ loadAllSingletons();
+ allSingletonsLoaded = true;
}
+ return new ArrayList<EdmSingleton>(singletons.values());
+ }
- protected abstract void loadAllSingletons();
+ protected abstract void loadAllSingletons();
- @Override
- public List<EdmActionImport> getActionImports() {
- if (!allActionImportsLoaded) {
- loadAllActionImports();
- allActionImportsLoaded = true;
- }
- return new ArrayList<EdmActionImport>(actionImports.values());
+ @Override
+ public List<EdmActionImport> getActionImports() {
+ if (!allActionImportsLoaded) {
+ loadAllActionImports();
+ allActionImportsLoaded = true;
}
+ return new ArrayList<EdmActionImport>(actionImports.values());
+ }
+
+ protected abstract void loadAllActionImports();
- protected abstract void loadAllActionImports();
+ @Override
+ public FullQualifiedName getParentContainerName() {
+ return parentContainerName;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
----------------------------------------------------------------------
diff --cc lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
index 96afc8e,8e6fc1f..bee5f90
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
@@@ -22,7 -22,8 +22,8 @@@ import java.util.Arrays
import java.util.List;
import org.apache.olingo.commons.api.ODataException;
++import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.apache.olingo.server.api.edm.provider.ComplexType;
import org.apache.olingo.server.api.edm.provider.EntitySet;
import org.apache.olingo.server.api.edm.provider.EntityType;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java
----------------------------------------------------------------------
diff --cc lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java
index 0000000,e843955..94ea6ea
mode 000000,100644..100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java
@@@ -1,0 -1,47 +1,47 @@@
+ /*
+ * 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.server.core.testutil.techprovider;
+
+ import java.util.Arrays;
+
+ import org.apache.olingo.commons.api.ODataException;
++import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+ import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+ import org.apache.olingo.server.api.edm.provider.EnumMember;
+ import org.apache.olingo.server.api.edm.provider.EnumType;
+
+ public class EnumTypeProvider {
+
+ public static final FullQualifiedName nameENString = new FullQualifiedName(SchemaProvider.nameSpace, "ENString");
+
+ public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
+ if (enumTypeName.equals(nameENString)) {
+ return new EnumType()
+ .setName("ENString")
+ .setFlags(true)
+ .setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
+ .setMembers(Arrays.asList(
+ new EnumMember().setName("String1").setValue("1"),
+ new EnumMember().setName("String2").setValue("2"),
+ new EnumMember().setName("String3").setValue("3")));
+ }
+
+ return null;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
----------------------------------------------------------------------
diff --cc lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
index 0000000,2b6e10e..5d1ad3b
mode 000000,100644..100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java
@@@ -1,0 -1,590 +1,590 @@@
+ /*
+ * 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.server.core.testutil.techprovider;
+
++import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+ import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+ import org.apache.olingo.server.api.edm.provider.NavigationProperty;
+ import org.apache.olingo.server.api.edm.provider.Property;
+
+ public class PropertyProvider {
+
+ // Primitive Type Names
+ public static final FullQualifiedName nameBinary = EdmPrimitiveTypeKind.Binary.getFullQualifiedName();
+ public static final FullQualifiedName nameBoolean = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
+ public static final FullQualifiedName nameByte = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
+
+ public static final FullQualifiedName nameDate = EdmPrimitiveTypeKind.Date.getFullQualifiedName();
+ public static final FullQualifiedName nameDateTimeOffset =
+ EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName();
+
+ public static final FullQualifiedName nameDecimal = EdmPrimitiveTypeKind.Decimal.getFullQualifiedName();
+ public static final FullQualifiedName nameDouble = EdmPrimitiveTypeKind.Double.getFullQualifiedName();
+ public static final FullQualifiedName nameDuration = EdmPrimitiveTypeKind.Duration.getFullQualifiedName();
+
+ public static final FullQualifiedName nameGuid = EdmPrimitiveTypeKind.Guid.getFullQualifiedName();
+ public static final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
+ public static final FullQualifiedName nameInt32 = EdmPrimitiveTypeKind.Int32.getFullQualifiedName();
+ public static final FullQualifiedName nameInt64 = EdmPrimitiveTypeKind.Int64.getFullQualifiedName();
+
+ public static final FullQualifiedName nameSByte = EdmPrimitiveTypeKind.SByte.getFullQualifiedName();
+ public static final FullQualifiedName nameSingle = EdmPrimitiveTypeKind.Single.getFullQualifiedName();
+
+ public static final FullQualifiedName nameString = EdmPrimitiveTypeKind.String.getFullQualifiedName();
+ public static final FullQualifiedName nameTimeOfDay = EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName();
+
+ // Primitive Properties --------------------------------------------------------------------------------------------
+ public static final Property collPropertyBinary = new Property()
+ .setName("CollPropertyBinary")
+ .setType(nameBinary)
+ .setCollection(true);
+
+ public static final Property collPropertyBinary_ExplicitNullable = new Property()
+ .setName("CollPropertyBinary")
+ .setType(nameBinary)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyBoolean = new Property()
+ .setName("CollPropertyBoolean")
+ .setType(nameBoolean)
+ .setCollection(true);
+
+ public static final Property collPropertyBoolean_ExplicitNullable = new Property()
+ .setName("CollPropertyBoolean")
+ .setType(nameBoolean)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyByte = new Property()
+ .setName("CollPropertyByte")
+ .setType(nameByte)
+ .setCollection(true);
+
+ public static final Property collPropertyByte_ExplicitNullable = new Property()
+ .setName("CollPropertyByte")
+ .setType(nameByte)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyDate = new Property()
+ .setName("CollPropertyDate")
+ .setType(nameDate)
+ .setCollection(true);
+
+ public static final Property collPropertyDate_ExplicitNullable = new Property()
+ .setName("CollPropertyDate")
+ .setType(nameDate)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyDateTimeOffset = new Property()
+ .setName("CollPropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setCollection(true);
+
+ public static final Property collPropertyDateTimeOffset_ExplicitNullable = new Property()
+ .setName("CollPropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyDecimal = new Property()
+ .setName("CollPropertyDecimal")
+ .setType(nameDecimal)
+ .setCollection(true);
+
+ public static final Property collPropertyDecimal_ExplicitNullable = new Property()
+ .setName("CollPropertyDecimal")
+ .setType(nameDecimal)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyDouble = new Property()
+ .setName("CollPropertyDouble")
+ .setType(nameDouble)
+ .setCollection(true);
+
+ public static final Property collPropertyDouble_ExplicitNullable = new Property()
+ .setName("CollPropertyDouble")
+ .setType(nameDouble)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyDuration = new Property()
+ .setName("CollPropertyDuration")
+ .setType(nameDuration)
+ .setCollection(true);
+
+ public static final Property collPropertyDuration_ExplicitNullable = new Property()
+ .setName("CollPropertyDuration")
+ .setType(nameDuration)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyGuid = new Property()
+ .setName("CollPropertyGuid")
+ .setType(nameGuid)
+ .setCollection(true);
+
+ public static final Property collPropertyGuid_ExplicitNullable = new Property()
+ .setName("CollPropertyGuid")
+ .setType(nameGuid)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyInt16 = new Property()
+ .setName("CollPropertyInt16")
+ .setType(nameInt16)
+ .setCollection(true);
+
+ public static final Property collPropertyInt16_ExplicitNullable = new Property()
+ .setName("CollPropertyInt16")
+ .setType(nameInt16)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyInt32 = new Property()
+ .setName("CollPropertyInt32")
+ .setType(nameInt32)
+ .setCollection(true);
+
+ public static final Property collPropertyInt32_ExplicitNullable = new Property()
+ .setName("CollPropertyInt32")
+ .setType(nameInt32)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyInt64 = new Property()
+ .setName("CollPropertyInt64")
+ .setType(nameInt64)
+ .setCollection(true);
+
+ public static final Property collPropertyInt64_ExplicitNullable = new Property()
+ .setName("CollPropertyInt64")
+ .setType(nameInt64)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertySByte = new Property()
+ .setName("CollPropertySByte")
+ .setType(nameSByte)
+ .setCollection(true);
+
+ public static final Property collPropertySByte_ExplicitNullable = new Property()
+ .setName("CollPropertySByte")
+ .setType(nameSByte)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertySingle = new Property()
+ .setName("CollPropertySingle")
+ .setType(nameSingle)
+ .setCollection(true);
+
+ public static final Property collPropertySingle_ExplicitNullable = new Property()
+ .setName("CollPropertySingle")
+ .setType(nameSingle)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyString = new Property()
+ .setName("CollPropertyString")
+ .setType(nameString)
+ .setCollection(true);
+
+ public static final Property collPropertyString_ExplicitNullable = new Property()
+ .setName("CollPropertyString")
+ .setType(nameString)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property collPropertyTimeOfDay = new Property()
+ .setName("CollPropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setCollection(true);
+
+ public static final Property collPropertyTimeOfDay_ExplicitNullable = new Property()
+ .setName("CollPropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setNullable(true)
+ .setCollection(true);
+
+ public static final Property propertyBinary = new Property()
+ .setName("PropertyBinary")
+ .setType(nameBinary);
+
+ public static final Property propertyBinary_NotNullable = new Property()
+ .setName("PropertyBinary")
+ .setType(nameBinary)
+ .setNullable(false);
+
+ public static final Property propertyBinary_ExplicitNullable = new Property()
+ .setName("PropertyBinary")
+ .setType(nameBinary)
+ .setNullable(true);
+
+ public static final Property propertyBoolean = new Property()
+ .setName("PropertyBoolean")
+ .setType(nameBoolean);
+
+ public static final Property propertyBoolean_NotNullable = new Property()
+ .setName("PropertyBoolean")
+ .setType(nameBoolean)
+ .setNullable(false);
+
+ public static final Property propertyBoolean_ExplicitNullable = new Property()
+ .setName("PropertyBoolean")
+ .setType(nameBoolean)
+ .setNullable(true);
+
+ public static final Property propertyByte = new Property()
+ .setName("PropertyByte")
+ .setType(nameByte);
+
+ public static final Property propertyByte_NotNullable = new Property()
+ .setName("PropertyByte")
+ .setType(nameByte)
+ .setNullable(false);
+
+ public static final Property propertyByte_ExplicitNullable = new Property()
+ .setName("PropertyByte")
+ .setType(nameByte)
+ .setNullable(true);
+
+ public static final Property propertyDate = new Property()
+ .setName("PropertyDate")
+ .setType(nameDate);
+
+ public static final Property propertyDate_NotNullable = new Property()
+ .setName("PropertyDate")
+ .setType(nameDate)
+ .setNullable(false);
+
+ public static final Property propertyDate_ExplicitNullable = new Property()
+ .setName("PropertyDate")
+ .setType(nameDate)
+ .setNullable(true);
+
+ public static final Property propertyDateTimeOffset = new Property()
+ .setName("PropertyDateTimeOffset")
+ .setType(nameDateTimeOffset);
+
+ public static final Property propertyDateTimeOffset_NotNullable = new Property()
+ .setName("PropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setNullable(false);
+
+ public static final Property propertyDateTimeOffset_ExplicitNullable = new Property()
+ .setName("PropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setNullable(true);
+
+ public static final Property propertyDecimal = new Property()
+ .setName("PropertyDecimal")
+ .setType(nameDecimal);
+
+ public static final Property propertyDecimal_NotNullable = new Property()
+ .setName("PropertyDecimal")
+ .setType(nameDecimal)
+ .setNullable(false);
+
+ public static final Property propertyDecimal_ExplicitNullable = new Property()
+ .setName("PropertyDecimal")
+ .setType(nameDecimal)
+ .setNullable(true);
+
+ public static final Property propertyDouble = new Property()
+ .setName("PropertyDouble")
+ .setType(nameDouble);
+
+ public static final Property propertyDouble_NotNullable = new Property()
+ .setName("PropertyDouble")
+ .setType(nameDouble)
+ .setNullable(false);
+
+ public static final Property propertyDouble_ExplicitNullable = new Property()
+ .setName("PropertyDouble")
+ .setType(nameDouble)
+ .setNullable(true);
+
+ public static final Property propertyDuration = new Property()
+ .setName("PropertyDuration")
+ .setType(nameDuration);
+
+ public static final Property propertyDuration_NotNullable = new Property()
+ .setName("PropertyDuration")
+ .setType(nameDuration)
+ .setNullable(false);
+
+ public static final Property propertyDuration_ExplicitNullable = new Property()
+ .setName("PropertyDuration")
+ .setType(nameDuration)
+ .setNullable(true);
+
+ public static final Property propertyGuid = new Property()
+ .setName("PropertyGuid")
+ .setType(nameGuid);
+
+ public static final Property propertyGuid_NotNullable = new Property()
+ .setName("PropertyGuid")
+ .setType(nameGuid)
+ .setNullable(false);
+
+ public static final Property propertyGuid_ExplicitNullable = new Property()
+ .setName("PropertyGuid")
+ .setType(nameGuid)
+ .setNullable(true);
+
+ public static final Property propertyInt16 = new Property()
+ .setName("PropertyInt16")
+ .setType(nameInt16);
+
+ public static final Property propertyInt16_NotNullable = new Property()
+ .setName("PropertyInt16")
+ .setType(nameInt16)
+ .setNullable(false);
+
+ public static final Property propertyInt16_ExplicitNullable = new Property()
+ .setName("PropertyInt16")
+ .setType(nameInt16)
+ .setNullable(true);
+
+ public static final Property propertyInt32 = new Property()
+ .setName("PropertyInt32")
+ .setType(nameInt32);
+
+ public static final Property propertyInt32_NotNullable = new Property()
+ .setName("PropertyInt32")
+ .setType(nameInt32)
+ .setNullable(false);
+
+ public static final Property propertyInt32_ExplicitNullable = new Property()
+ .setName("PropertyInt32")
+ .setType(nameInt32)
+ .setNullable(true);
+
+ public static final Property propertyInt64 = new Property()
+ .setName("PropertyInt64")
+ .setType(nameInt64);
+
+ public static final Property propertyInt64_NotNullable = new Property()
+ .setName("PropertyInt64")
+ .setType(nameInt64)
+ .setNullable(false);
+
+ public static final Property propertyInt64_ExplicitNullable = new Property()
+ .setName("PropertyInt64")
+ .setType(nameInt64)
+ .setNullable(true);
+
+ public static final Property propertySByte = new Property()
+ .setName("PropertySByte")
+ .setType(nameSByte);
+
+ public static final Property propertySByte_NotNullable = new Property()
+ .setName("PropertySByte")
+ .setType(nameSByte)
+ .setNullable(false);
+
+ public static final Property propertySByte_ExplicitNullable = new Property()
+ .setName("PropertySByte")
+ .setType(nameSByte)
+ .setNullable(true);
+
+ public static final Property propertySingle = new Property()
+ .setName("PropertySingle")
+ .setType(nameSingle);
+
+ public static final Property propertySingle_NotNullable = new Property()
+ .setName("PropertySingle")
+ .setType(nameSingle)
+ .setNullable(false);
+
+ public static final Property propertySingle_ExplicitNullable = new Property()
+ .setName("PropertySingle")
+ .setType(nameSingle)
+ .setNullable(true);
+
+ public static final Property propertyString = new Property()
+ .setName("PropertyString")
+ .setType(nameString);
+
+ public static final Property propertyString_NotNullable = new Property()
+ .setName("PropertyString")
+ .setType(nameString)
+ .setNullable(false);
+
+ public static final Property propertyString_ExplicitNullable = new Property()
+ .setName("PropertyString")
+ .setType(nameString)
+ .setNullable(true);
+
+ public static final Property propertyTimeOfDay = new Property()
+ .setName("PropertyTimeOfDay")
+ .setType(nameTimeOfDay);
+
+ public static final Property propertyTimeOfDay_NotNullable = new Property()
+ .setName("PropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setNullable(false);
+
+ public static final Property propertyTimeOfDay_ExplicitNullable = new Property()
+ .setName("PropertyTimeOfDay")
+ .setType(nameTimeOfDay)
+ .setNullable(true);
+
+ /*
+ * TODO add propertyStream
+ * Property propertyStream = new Property()
+ * .setName("PropertyStream")
+ * .setType(EdmStream.getFullQualifiedName());
+ */
+
+ // Complex Properties ----------------------------------------------------------------------------------------------
+ public static final Property collPropertyComplex_CTPrimComp = new Property()
+ .setName("CollPropertyComplex")
+ .setType(ComplexTypeProvider.nameCTPrimComp)
+ .setCollection(true);
+
+ public static final Property collPropertyComplex_CTTwoPrim = new Property()
+ .setName("CollPropertyComplex")
+ .setType(ComplexTypeProvider.nameCTTwoPrim)
+ .setCollection(true);
+
+ public static final Property propertyComplex_CTAllPrim = new Property()
+ .setName("PropertyComplex")
+ .setType(ComplexTypeProvider.nameCTAllPrim);
+
+ public static final Property propertyComplex_CTCollAllPrim = new Property()
+ .setName("PropertyComplex")
+ .setType(ComplexTypeProvider.nameCTCollAllPrim);
+
+ public static final Property propertyComplex_CTCompCollComp = new Property()
+ .setName("PropertyComplex")
+ .setType(ComplexTypeProvider.nameCTCompCollComp);
+
+ public static final Property propertyComplex_CTCompComp = new Property()
+ .setName("PropertyComplex")
+ .setType(ComplexTypeProvider.nameCTCompComp);
+
+ public static final Property propertyComplex_CTNavFiveProp = new Property()
+ .setName("PropertyComplex")
+ .setType(ComplexTypeProvider.nameCTNavFiveProp);
+
+ public static final Property propertyComplex_CTPrimComp_NotNullable = new Property()
+ .setName("PropertyComplex")
+ .setType(ComplexTypeProvider.nameCTPrimComp)
+ .setNullable(false);
+
+ public static final Property propertyComplex_CTTwoPrim = new Property()
+ .setName("PropertyComplex")
+ .setType(ComplexTypeProvider.nameCTTwoPrim);
+
+ public static final Property propertyComplexAllPrim_CTAllPrim = new Property()
+ .setName("PropertyComplexAllPrim")
+ .setType(ComplexTypeProvider.nameCTAllPrim);
+
+ public static final Property propertyComplexComplex_CTCompComp = new Property()
+ .setName("PropertyComplexComplex")
+ .setType(ComplexTypeProvider.nameCTCompComp);
+
+ public static final Property propertyComplexEnum_CTPrimEnum_NotNullable = new Property()
+ .setName("PropertyComplexEnum")
+ .setType(ComplexTypeProvider.nameCTPrimEnum)
+ .setNullable(false);
+
+ public static final Property propertyComplexTwoPrim_CTTwoPrim = new Property()
+ .setName("PropertyComplexTwoPrim")
+ .setType(ComplexTypeProvider.nameCTTwoPrim);
+
+ public static final Property propertyMixedPrimCollComp_CTMixPrimCollComp = new Property()
+ .setName("PropertyMixedPrimCollComp")
+ .setType(ComplexTypeProvider.nameCTMixPrimCollComp);
+
+ // Navigation Properties -------------------------------------------------------------------------------------------
+ public static final NavigationProperty collectionNavPropertyETKeyNavMany_ETKeyNav = new NavigationProperty()
+ .setName("NavPropertyETKeyNavMany")
+ .setType(EntityTypeProvider.nameETKeyNav)
+ .setCollection(true);
+
+ public static final NavigationProperty collectionNavPropertyETMediaMany_ETMedia = new NavigationProperty()
+ .setName("NavPropertyETMediaMany")
+ .setType(EntityTypeProvider.nameETMedia)
+ .setCollection(true);
+
+ public static final NavigationProperty collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavMany")
+ .setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setCollection(true)
+ .setPartner("NavPropertyETKeyNavOne");
+
+ public static final NavigationProperty collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavOne")
+ .setType(EntityTypeProvider.nameETTwoKeyNav);
+
+ public static final NavigationProperty collectionNavPropertyETTwoPrimMany_ETTwoPrim = new NavigationProperty()
+ .setName("NavPropertyETTwoPrimMany")
+ .setType(EntityTypeProvider.nameETTwoPrim)
+ .setCollection(true)
+ .setNullable(false);
+
+ public static final NavigationProperty collectionNavPropertyETAllPrimMany_ETAllPrim = new NavigationProperty()
+ .setName("NavPropertyETAllPrimMany")
+ .setType(EntityTypeProvider.nameETAllPrim)
+ .setCollection(true);
+
+ public static final NavigationProperty navPropertyETKeyNavOne_ETKeyNav = new NavigationProperty()
+ .setName("NavPropertyETKeyNavOne")
+ .setType(EntityTypeProvider.nameETKeyNav);
+
+ public static final NavigationProperty navPropertyETMediaOne_ETMedia = new NavigationProperty()
+ .setName("NavPropertyETMediaOne")
+ .setType(EntityTypeProvider.nameETMedia);
+
+ public static final NavigationProperty navPropertyETKeyPrimNavOne_ETKeyPrimNav = new NavigationProperty()
+ .setName("NavPropertyETKeyPrimNavOne")
+ .setType(EntityTypeProvider.nameETKeyPrimNav);
+
+ public static final NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav_NotNullable = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavOne")
+ .setType(EntityTypeProvider.nameETTwoKeyNav)
+ .setNullable(false);
+
+ public static final NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavOne")
+ .setType(EntityTypeProvider.nameETTwoKeyNav);
+
+ public static final NavigationProperty navPropertyETTwoPrimOne_ETTwoPrim = new NavigationProperty()
+ .setName("NavPropertyETTwoPrimOne")
+ .setType(EntityTypeProvider.nameETTwoPrim)
+ .setNullable(false);
+
+ public static final NavigationProperty navPropertyETAllPrimOne_ETAllPrim = new NavigationProperty()
+ .setName("NavPropertyETAllPrimOne")
+ .setType(EntityTypeProvider.nameETAllPrim);
+
+ // EnumProperties --------------------------------------------------------------------------------------------------
+ public static final Property propertyEnumString_ENString = new Property()
+ .setName("PropertyEnumString")
+ .setType(EnumTypeProvider.nameENString);
+
+ // TypeDefinition Properties ---------------------------------------------------------------------------------------
+
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/793c56e8/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
----------------------------------------------------------------------
[43/51] [abbrv] [OLINGO-230] Implementation completed
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
deleted file mode 100644
index d9106a7..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
+++ /dev/null
@@ -1,240 +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.commons.core.data;
-
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.CollectionValue;
-import org.apache.olingo.commons.api.data.Value;
-import org.apache.olingo.commons.api.domain.ODataPropertyType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-class AtomPropertyDeserializer extends AbstractAtomDealer {
-
- private final AtomGeoValueDeserializer geoDeserializer;
-
- public AtomPropertyDeserializer(final ODataServiceVersion version) {
- super(version);
- this.geoDeserializer = new AtomGeoValueDeserializer();
- }
-
- private Value fromPrimitive(final XMLEventReader reader, final StartElement start,
- final EdmTypeInfo typeInfo) throws XMLStreamException {
-
- Value value = null;
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
- final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
- version, typeInfo.getFullQualifiedName().toString());
- value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
- }
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
- && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
-
- value = new PrimitiveValueImpl(event.asCharacters().getData());
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return value == null ? new PrimitiveValueImpl(StringUtils.EMPTY) : value;
- }
-
- private Value fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException {
-
- Value value = null;
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- if (value == null) {
- value = new ComplexValueImpl();
- }
- value.asComplex().get().add(deserialize(reader, event.asStartElement()));
- }
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- value = new EnumValueImpl(event.asCharacters().getData());
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return value;
- }
-
- private CollectionValue fromCollection(final XMLEventReader reader, final StartElement start,
- final EdmTypeInfo typeInfo) throws XMLStreamException {
-
- final CollectionValueImpl value = new CollectionValueImpl();
-
- final EdmTypeInfo type = typeInfo == null
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- switch (guessPropertyType(reader, typeInfo)) {
- case COMPLEX:
- case ENUM:
- value.get().add(fromComplexOrEnum(reader, event.asStartElement()));
- break;
-
- case PRIMITIVE:
- value.get().add(fromPrimitive(reader, event.asStartElement(), type));
- break;
-
- default:
- // do not add null or empty values
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return value;
- }
-
- private ODataPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo)
- throws XMLStreamException {
-
- XMLEvent child = null;
- while (reader.hasNext() && child == null) {
- final XMLEvent event = reader.peek();
- if (event.isCharacters() && event.asCharacters().isWhiteSpace()) {
- reader.nextEvent();
- } else {
- child = event;
- }
- }
-
- final ODataPropertyType type;
- if (child == null) {
- type = typeInfo == null || typeInfo.isPrimitiveType()
- ? ODataPropertyType.PRIMITIVE
- : ODataPropertyType.ENUM;
- } else {
- if (child.isStartElement()) {
- if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) {
- type = ODataPropertyType.PRIMITIVE;
- } else if (elementQName.equals(child.asStartElement().getName())) {
- type = ODataPropertyType.COLLECTION;
- } else {
- type = ODataPropertyType.COMPLEX;
- }
- } else if (child.isCharacters()) {
- type = typeInfo == null || typeInfo.isPrimitiveType()
- ? ODataPropertyType.PRIMITIVE
- : ODataPropertyType.ENUM;
- } else {
- type = ODataPropertyType.EMPTY;
- }
- }
-
- return type;
- }
-
- public AtomPropertyImpl deserialize(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException {
-
- final AtomPropertyImpl property = new AtomPropertyImpl();
-
- if (ODataServiceVersion.V40 == version && v4PropertyValueQName.equals(start.getName())) {
- // retrieve name from context
- final Attribute context = start.getAttributeByName(contextQName);
- if (context != null) {
- property.setName(StringUtils.substringAfterLast(context.getValue(), "/"));
- }
- } else {
- property.setName(start.getName().getLocalPart());
- }
-
- final Attribute nullAttr = start.getAttributeByName(this.nullQName);
-
- Value value;
- if (nullAttr == null) {
- final Attribute typeAttr = start.getAttributeByName(this.typeQName);
- final String typeAttrValue = typeAttr == null ? null : typeAttr.getValue();
-
- final EdmTypeInfo typeInfo = StringUtils.isBlank(typeAttrValue)
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(typeAttrValue).build();
-
- if (typeInfo != null) {
- property.setType(typeInfo.getTypeExpression());
- }
-
- final ODataPropertyType propType = typeInfo == null
- ? guessPropertyType(reader, typeInfo)
- : typeInfo.isCollection()
- ? ODataPropertyType.COLLECTION
- : typeInfo.isPrimitiveType()
- ? ODataPropertyType.PRIMITIVE
- : ODataPropertyType.COMPLEX;
-
- switch (propType) {
- case COLLECTION:
- value = fromCollection(reader, start, typeInfo);
- break;
-
- case COMPLEX:
- value = fromComplexOrEnum(reader, start);
- break;
-
- case PRIMITIVE:
- value = fromPrimitive(reader, start, typeInfo);
- break;
-
- case EMPTY:
- default:
- value = new PrimitiveValueImpl(StringUtils.EMPTY);
- }
- } else {
- value = new NullValueImpl();
- }
-
- property.setValue(value);
-
- return property;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
deleted file mode 100644
index 0461ad2..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
+++ /dev/null
@@ -1,116 +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.commons.core.data;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.CollectionValue;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.Value;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-class AtomPropertySerializer extends AbstractAtomDealer {
-
- private final AtomGeoValueSerializer geoSerializer;
-
- public AtomPropertySerializer(final ODataServiceVersion version) {
- super(version);
- this.geoSerializer = new AtomGeoValueSerializer();
- }
-
- private void collection(final XMLStreamWriter writer, final CollectionValue value) throws XMLStreamException {
- for (Value item : value.get()) {
- if (version == ODataServiceVersion.V30) {
- writer.writeStartElement(Constants.PREFIX_DATASERVICES, Constants.ELEM_ELEMENT,
- version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
- } else {
- writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ELEM_ELEMENT,
- version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
- }
- value(writer, item);
- writer.writeEndElement();
- }
- }
-
- private void value(final XMLStreamWriter writer, final Value value) throws XMLStreamException {
- if (value.isPrimitive()) {
- writer.writeCharacters(value.asPrimitive().get());
- } else if (value.isEnum()) {
- writer.writeCharacters(value.asEnum().get());
- } else if (value.isGeospatial()) {
- this.geoSerializer.serialize(writer, value.asGeospatial().get());
- } else if (value.isCollection()) {
- collection(writer, value.asCollection());
- } else if (value.isComplex()) {
- for (Property property : value.asComplex().get()) {
- property(writer, property, false);
- }
- }
- }
-
- public void property(final XMLStreamWriter writer, final Property property, final boolean standalone)
- throws XMLStreamException {
-
- if (version == ODataServiceVersion.V40 && standalone) {
- writer.writeStartElement(Constants.PREFIX_METADATA, Constants.VALUE,
- version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
- } else {
- writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(),
- version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
- }
-
- if (standalone) {
- namespaces(writer);
- }
-
- if (StringUtils.isNotBlank(property.getType())) {
- String type = property.getType();
- if (version == ODataServiceVersion.V40) {
- final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
- if (typeInfo.isPrimitiveType()) {
- if (typeInfo.isCollection()) {
- type = "#Collection(" + typeInfo.getFullQualifiedName().getName() + ")";
- } else {
- type = typeInfo.getFullQualifiedName().getName();
- }
- } else {
- type = "#" + property.getType();
- }
- }
- writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
- Constants.ATTR_TYPE, type);
- }
-
- if (property.getValue().isNull()) {
- writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
- Constants.ATTR_NULL, Boolean.TRUE.toString());
- } else {
- value(writer, property.getValue());
- }
-
- writer.writeEndElement();
- }
-
- public void property(final XMLStreamWriter writer, final Property property) throws XMLStreamException {
- property(writer, property, true);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
index f89aaee..d0e8587 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
@@ -27,22 +27,106 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
public class AtomSerializer extends AbstractAtomDealer {
private static final XMLOutputFactory FACTORY = XMLOutputFactory.newInstance();
- private final AtomPropertySerializer propSerializer;
+ private final AtomGeoValueSerializer geoSerializer;
public AtomSerializer(final ODataServiceVersion version) {
super(version);
- this.propSerializer = new AtomPropertySerializer(version);
+ this.geoSerializer = new AtomGeoValueSerializer();
+ }
+
+ private void collection(final XMLStreamWriter writer, final CollectionValue value) throws XMLStreamException {
+ for (Value item : value.get()) {
+ if (version.compareTo(ODataServiceVersion.V40) < 0) {
+ writer.writeStartElement(Constants.PREFIX_DATASERVICES, Constants.ELEM_ELEMENT,
+ version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ } else {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ELEM_ELEMENT,
+ version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+ }
+ value(writer, item);
+ writer.writeEndElement();
+ }
+ }
+
+ private void value(final XMLStreamWriter writer, final Value value) throws XMLStreamException {
+ if (value.isPrimitive()) {
+ writer.writeCharacters(value.asPrimitive().get());
+ } else if (value.isEnum()) {
+ writer.writeCharacters(value.asEnum().get());
+ } else if (value.isGeospatial()) {
+ this.geoSerializer.serialize(writer, value.asGeospatial().get());
+ } else if (value.isCollection()) {
+ collection(writer, value.asCollection());
+ } else if (value.isComplex()) {
+ for (Property property : value.asComplex().get()) {
+ property(writer, property, false);
+ }
+ }
+ }
+
+ public void property(final XMLStreamWriter writer, final Property property, final boolean standalone)
+ throws XMLStreamException {
+
+ if (version.compareTo(ODataServiceVersion.V40) >= 0 && standalone) {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.VALUE,
+ version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ } else {
+ writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(),
+ version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ }
+
+ if (standalone) {
+ namespaces(writer);
+ }
+
+ if (StringUtils.isNotBlank(property.getType())) {
+ String type = property.getType();
+ if (version.compareTo(ODataServiceVersion.V40) >= 0) {
+ final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+ if (typeInfo.isPrimitiveType()) {
+ if (typeInfo.isCollection()) {
+ type = "#Collection(" + typeInfo.getFullQualifiedName().getName() + ")";
+ } else {
+ type = typeInfo.getFullQualifiedName().getName();
+ }
+ } else {
+ type = "#" + property.getType();
+ }
+ }
+ writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
+ Constants.ATTR_TYPE, type);
+ }
+
+ if (property.getValue().isNull()) {
+ writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
+ Constants.ATTR_NULL, Boolean.TRUE.toString());
+ } else {
+ value(writer, property.getValue());
+ if (property.getValue().isLinkedComplex()) {
+ links(writer, property.getValue().asLinkedComplex().getAssociationLinks());
+ links(writer, property.getValue().asLinkedComplex().getNavigationLinks());
+ }
+ }
+
+ writer.writeEndElement();
+ }
+
+ private void property(final XMLStreamWriter writer, final Property property) throws XMLStreamException {
+ property(writer, property, true);
}
private void startDocument(final XMLStreamWriter writer, final String rootElement) throws XMLStreamException {
@@ -59,7 +143,7 @@ public class AtomSerializer extends AbstractAtomDealer {
writer.writeStartDocument();
- propSerializer.property(writer, property);
+ property(writer, property);
writer.writeEndDocument();
writer.flush();
@@ -122,7 +206,7 @@ public class AtomSerializer extends AbstractAtomDealer {
private void properties(final XMLStreamWriter writer, final List<Property> properties) throws XMLStreamException {
for (Property property : properties) {
- propSerializer.property(writer, property, false);
+ property(writer, property, false);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
index 8abd3f3..2c8399d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -21,11 +21,8 @@ package org.apache.olingo.commons.core.data;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import java.net.URI;
@@ -47,47 +44,11 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
*/
public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImpl> {
- private String getTitle(final Map.Entry<String, JsonNode> entry) {
- return entry.getKey().substring(0, entry.getKey().indexOf('@'));
- }
-
- private String setInline(final String name, final String suffix, final ObjectNode tree,
- final ObjectCodec codec, final LinkImpl link) throws IOException {
-
- final String entryNamePrefix = name.substring(0, name.indexOf(suffix));
- if (tree.has(entryNamePrefix)) {
- final JsonNode inline = tree.path(entryNamePrefix);
-
- if (inline instanceof ObjectNode) {
- link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
-
- link.setInlineEntry(inline.traverse(codec).<Container<JSONEntryImpl>>readValueAs(
- new TypeReference<JSONEntryImpl>() {
- }).getObject());
- }
-
- if (inline instanceof ArrayNode) {
- link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
-
- final JSONFeedImpl feed = new JSONFeedImpl();
- final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
- while (entries.hasNext()) {
- feed.getEntries().add(entries.next().traverse(codec).<Container<JSONEntryImpl>>readValuesAs(
- new TypeReference<JSONEntryImpl>() {
- }).next().getObject());
- }
-
- link.setInlineFeed(feed);
- }
- }
- return entryNamePrefix;
- }
-
@Override
protected Container<JSONEntryImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
+ final ObjectNode tree = parser.getCodec().readTree(parser);
if (tree.has(Constants.VALUE) && tree.get(Constants.VALUE).isArray()) {
throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation());
@@ -173,35 +134,8 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
final Map.Entry<String, JsonNode> field = itor.next();
- if (field.getKey().endsWith(jsonNavigationLink)) {
- final LinkImpl link = new LinkImpl();
- link.setTitle(getTitle(field));
- link.setRel(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + getTitle(field));
-
- if (field.getValue().isValueNode()) {
- link.setHref(field.getValue().textValue());
- link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
- }
- // NOTE: this should be expected to happen, but it isn't - at least up to OData 4.0
- /* if (field.getValue().isArray()) {
- * link.setHref(field.getValue().asText());
- * link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
- * } */
-
- entry.getNavigationLinks().add(link);
-
- toRemove.add(field.getKey());
- toRemove.add(setInline(field.getKey(), jsonNavigationLink, tree, parser.getCodec(), link));
- } else if (field.getKey().endsWith(jsonAssociationLink)) {
- final LinkImpl link = new LinkImpl();
- link.setTitle(getTitle(field));
- link.setRel(version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL) + getTitle(field));
- link.setHref(field.getValue().textValue());
- link.setType(ODataLinkType.ASSOCIATION.toString());
- entry.getAssociationLinks().add(link);
-
- toRemove.add(field.getKey());
- } else if (field.getKey().endsWith(getJSONAnnotation(jsonMediaEditLink))) {
+ links(field, entry, toRemove, tree, parser.getCodec());
+ if (field.getKey().endsWith(getJSONAnnotation(jsonMediaEditLink))) {
final LinkImpl link = new LinkImpl();
link.setTitle(getTitle(field));
link.setRel(version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL) + getTitle(field));
@@ -251,7 +185,7 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
property.setType(type);
type = null;
- value(property, field.getValue());
+ value(property, field.getValue(), parser.getCodec());
entry.getProperties().add(property);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
index eb51362..1f4bbea 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
@@ -22,16 +22,9 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
@@ -49,49 +42,12 @@ public class JSONEntrySerializer extends AbstractJsonSerializer<JSONEntryImpl> {
jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), entry.getId());
}
- final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
-
- for (Link link : entry.getNavigationLinks()) {
- ODataLinkType type = null;
- try {
- type = ODataLinkType.fromString(version, link.getRel(), link.getType());
- } catch (IllegalArgumentException e) {
- // ignore
- }
-
- if (type == ODataLinkType.ENTITY_SET_NAVIGATION) {
- final List<String> uris;
- if (entitySetLinks.containsKey(link.getTitle())) {
- uris = entitySetLinks.get(link.getTitle());
- } else {
- uris = new ArrayList<String>();
- entitySetLinks.put(link.getTitle(), uris);
- }
- uris.add(link.getHref());
- } else {
- if (StringUtils.isNotBlank(link.getHref())) {
- jgen.writeStringField(link.getTitle() + Constants.JSON_BIND_LINK_SUFFIX, link.getHref());
- }
- }
-
- if (link.getInlineEntry() != null) {
- jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
- } else if (link.getInlineFeed() != null) {
- jgen.writeArrayFieldStart(link.getTitle());
- for (Entry subEntry : link.getInlineFeed().getEntries()) {
- jgen.writeObject(subEntry);
- }
- jgen.writeEndArray();
- }
- }
- for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
- jgen.writeArrayFieldStart(entitySetLink.getKey() + Constants.JSON_BIND_LINK_SUFFIX);
- for (String uri : entitySetLink.getValue()) {
- jgen.writeString(uri);
- }
- jgen.writeEndArray();
+ for (Property property : entry.getProperties()) {
+ property(jgen, property, property.getName());
}
+ links(entry, jgen);
+
for (Link link : entry.getMediaEditLinks()) {
if (link.getTitle() == null) {
jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK), link.getHref());
@@ -109,10 +65,6 @@ public class JSONEntrySerializer extends AbstractJsonSerializer<JSONEntryImpl> {
}
}
- for (Property property : entry.getProperties()) {
- property(jgen, property, property.getName());
- }
-
jgen.writeEndObject();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 381b6d4..d640a60 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -73,7 +73,7 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPrope
}
if (property.getValue() == null) {
- value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : tree);
+ value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : tree, parser.getCodec());
}
return new Container<JSONPropertyImpl>(contextURL, metadataETag, property);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
new file mode 100644
index 0000000..4394dfa
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
@@ -0,0 +1,47 @@
+/*
+ * 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.commons.core.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.LinkedComplexValue;
+
+public class LinkedComplexValueImpl extends ComplexValueImpl implements LinkedComplexValue {
+
+ private final List<Link> associationLinks = new ArrayList<Link>();
+
+ private final List<Link> navigationLinks = new ArrayList<Link>();
+
+ @Override
+ public boolean isLinkedComplex() {
+ return true;
+ }
+
+ @Override
+ public List<Link> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ @Override
+ public List<Link> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
index b0e0539..f130d90 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.commons.core.domain.v4;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.core.domain.AbstractODataCollectionValue;
@@ -39,4 +40,14 @@ public class ODataCollectionValueImpl extends AbstractODataCollectionValue<OData
public ODataEnumValue asEnum() {
return null;
}
+
+ @Override
+ public boolean isLinkedComplex() {
+ return false;
+ }
+
+ @Override
+ public ODataLinkedComplexValue asLinkedComplex() {
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
index 7c6e72f..711fd53 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
@@ -18,15 +18,28 @@
*/
package org.apache.olingo.commons.core.domain.v4;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
-import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.core.domain.AbstractODataComplexValue;
-public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProperty> implements ODataValue {
+public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProperty> implements ODataLinkedComplexValue {
private static final long serialVersionUID = 1143925901934898802L;
+ /**
+ * Navigation links (might contain in-line entities or feeds).
+ */
+ private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Association links.
+ */
+ private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
+
public ODataComplexValueImpl(final String typeName) {
super(typeName);
}
@@ -41,4 +54,73 @@ public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProper
return null;
}
+ @Override
+ public boolean isLinkedComplex() {
+ return true;
+ }
+
+ @Override
+ public ODataLinkedComplexValue asLinkedComplex() {
+ return this;
+ }
+
+ @Override
+ public boolean addLink(final ODataLink link) {
+ boolean result = false;
+
+ switch (link.getType()) {
+ case ASSOCIATION:
+ result = associationLinks.contains(link) ? false : associationLinks.add(link);
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
+ break;
+
+ case MEDIA_EDIT:
+ throw new IllegalArgumentException("Complex values cannot have media links!");
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean removeLink(final ODataLink link) {
+ return associationLinks.remove(link) || navigationLinks.remove(link);
+ }
+
+ private ODataLink getLink(final List<ODataLink> links, final String name) {
+ ODataLink result = null;
+ for (ODataLink link : links) {
+ if (name.equals(link.getName())) {
+ result = link;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public ODataLink getNavigationLink(final String name) {
+ return getLink(navigationLinks, name);
+ }
+
+ @Override
+ public List<ODataLink> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ @Override
+ public ODataLink getAssociationLink(final String name) {
+ return getLink(associationLinks, name);
+ }
+
+ @Override
+ public List<ODataLink> getAssociationLinks() {
+ return associationLinks;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
index ee21018..f68fc7f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
@@ -19,6 +19,7 @@
package org.apache.olingo.commons.core.domain.v4;
import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
public class ODataEnumValueImpl extends AbstractODataValue implements ODataEnumValue {
@@ -47,4 +48,13 @@ public class ODataEnumValueImpl extends AbstractODataValue implements ODataEnumV
return this;
}
+ @Override
+ public boolean isLinkedComplex() {
+ return false;
+ }
+
+ @Override
+ public ODataLinkedComplexValue asLinkedComplex() {
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
index 4f46a76..ddb0a53 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
@@ -27,6 +27,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -76,6 +77,11 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
}
@Override
+ public ODataLinkedComplexValue newLinkedComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
public ODataCollectionValue<ODataValue> newCollectionValue(final String typeName) {
return new ODataCollectionValueImpl(typeName);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
index 0d7ace8..dcf51c9 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.commons.core.domain.v4;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -53,4 +54,14 @@ public class ODataPrimitiveValueImpl extends AbstractODataPrimitiveValue impleme
return null;
}
+ @Override
+ public boolean isLinkedComplex() {
+ return false;
+ }
+
+ @Override
+ public ODataLinkedComplexValue asLinkedComplex() {
+ return null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16d3b028/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
index 85cdf67..34b4cfa 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
@@ -21,6 +21,7 @@ package org.apache.olingo.commons.core.domain.v4;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.core.domain.AbstractODataProperty;
@@ -41,7 +42,9 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
@Override
public ODataEnumValue getEnumValue() {
- return hasEnumValue() ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asEnum() : null;
+ return hasEnumValue()
+ ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asEnum()
+ : null;
}
@Override
@@ -50,8 +53,17 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
}
@Override
+ public ODataLinkedComplexValue getLinkedComplexValue() {
+ return hasComplexValue() && getValue() instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
+ ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asLinkedComplex()
+ : null;
+ }
+
+ @Override
public ODataCollectionValue<ODataValue> getCollectionValue() {
- return hasCollectionValue() ? getValue().<ODataValue>asCollection() : null;
+ return hasCollectionValue()
+ ? getValue().<ODataValue>asCollection()
+ : null;
}
}
[40/51] [abbrv] git commit: [OLINGO-222] Remove Incubating from
module names
Posted by sk...@apache.org.
[OLINGO-222] Remove Incubating from module names
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/242f782b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/242f782b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/242f782b
Branch: refs/heads/olingo-206-validator
Commit: 242f782b80f4244f046b89dffb151531048de2aa
Parents: 793c56e
Author: Christian Amend <ch...@apache.org>
Authored: Wed Apr 2 10:53:41 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Wed Apr 2 10:53:41 2014 +0200
----------------------------------------------------------------------
fit/pom.xml | 4 ++--
lib/client-api/pom.xml | 6 +++---
lib/client-core/pom.xml | 10 +++++-----
lib/commons-api/pom.xml | 4 ++--
lib/commons-core/pom.xml | 6 +++---
lib/pom.xml | 4 ++--
lib/ref/pom.xml | 8 ++++----
lib/server-api/pom.xml | 6 +++---
lib/server-core/pom.xml | 8 ++++----
pom.xml | 4 ++--
10 files changed, 30 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index cac0eca..b0c1d0a 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -23,13 +23,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-fit-incubating</artifactId>
+ <artifactId>olingo-fit</artifactId>
<packaging>war</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-parent-incubating</artifactId>
+ <artifactId>olingo-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/lib/client-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml
index 017ec12..7281ff3 100644
--- a/lib/client-api/pom.xml
+++ b/lib/client-api/pom.xml
@@ -23,13 +23,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-client-api-incubating</artifactId>
+ <artifactId>olingo-client-api</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-lib-incubating</artifactId>
+ <artifactId>olingo-lib</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -37,7 +37,7 @@
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-commons-api-incubating</artifactId>
+ <artifactId>olingo-commons-api</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/lib/client-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/pom.xml b/lib/client-core/pom.xml
index 6039cfd..81aaf9f 100644
--- a/lib/client-core/pom.xml
+++ b/lib/client-core/pom.xml
@@ -23,13 +23,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-client-core-incubating</artifactId>
+ <artifactId>olingo-client-core</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-lib-incubating</artifactId>
+ <artifactId>olingo-lib</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -37,12 +37,12 @@
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-client-api-incubating</artifactId>
+ <artifactId>olingo-client-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-commons-core-incubating</artifactId>
+ <artifactId>olingo-commons-core</artifactId>
<version>${project.version}</version>
</dependency>
@@ -61,7 +61,7 @@
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-fit-incubating</artifactId>
+ <artifactId>olingo-fit</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/lib/commons-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index 4b75469..619703e 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -23,13 +23,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-commons-api-incubating</artifactId>
+ <artifactId>olingo-commons-api</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-lib-incubating</artifactId>
+ <artifactId>olingo-lib</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/lib/commons-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-core/pom.xml b/lib/commons-core/pom.xml
index f025fd0..8977822 100644
--- a/lib/commons-core/pom.xml
+++ b/lib/commons-core/pom.xml
@@ -23,13 +23,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-commons-core-incubating</artifactId>
+ <artifactId>olingo-commons-core</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-lib-incubating</artifactId>
+ <artifactId>olingo-lib</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -37,7 +37,7 @@
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-commons-api-incubating</artifactId>
+ <artifactId>olingo-commons-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/lib/pom.xml
----------------------------------------------------------------------
diff --git a/lib/pom.xml b/lib/pom.xml
index 6686c7f..ae179b7 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -24,13 +24,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-lib-incubating</artifactId>
+ <artifactId>olingo-lib</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-parent-incubating</artifactId>
+ <artifactId>olingo-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/lib/ref/pom.xml
----------------------------------------------------------------------
diff --git a/lib/ref/pom.xml b/lib/ref/pom.xml
index ef86798..c928418 100644
--- a/lib/ref/pom.xml
+++ b/lib/ref/pom.xml
@@ -23,13 +23,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-ref-incubating</artifactId>
+ <artifactId>olingo-ref</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-lib-incubating</artifactId>
+ <artifactId>olingo-lib</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -37,12 +37,12 @@
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-server-api-incubating</artifactId>
+ <artifactId>olingo-server-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-client-api-incubating</artifactId>
+ <artifactId>olingo-client-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/lib/server-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-api/pom.xml b/lib/server-api/pom.xml
index f426d0d..b0bdda3 100644
--- a/lib/server-api/pom.xml
+++ b/lib/server-api/pom.xml
@@ -23,13 +23,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-server-api-incubating</artifactId>
+ <artifactId>olingo-server-api</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-lib-incubating</artifactId>
+ <artifactId>olingo-lib</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -37,7 +37,7 @@
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-commons-api-incubating</artifactId>
+ <artifactId>olingo-commons-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/lib/server-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml
index 686b1e7..5d90ae8 100644
--- a/lib/server-core/pom.xml
+++ b/lib/server-core/pom.xml
@@ -23,13 +23,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-server-core-incubating</artifactId>
+ <artifactId>olingo-server-core</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-lib-incubating</artifactId>
+ <artifactId>olingo-lib</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -37,12 +37,12 @@
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-server-api-incubating</artifactId>
+ <artifactId>olingo-server-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-commons-core-incubating</artifactId>
+ <artifactId>olingo-commons-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/242f782b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3f82dd4..3db438d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-parent-incubating</artifactId>
+ <artifactId>olingo-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
@@ -291,7 +291,7 @@
<deployables>
<deployable>
<groupId>org.apache.olingo</groupId>
- <artifactId>olingo-fit-incubating</artifactId>
+ <artifactId>olingo-fit</artifactId>
<type>war</type>
<properties>
<context>/</context>
[19/51] [abbrv] [OLINGO-205,
OLINGO-175] provided JSON integration tests + refactoring and fixes
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
index ace5487..af957a1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
@@ -20,11 +20,9 @@ package org.apache.olingo.client.core.data.v3;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.net.URI;
import org.apache.olingo.client.core.data.AbstractServiceDocument;
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
-import org.apache.olingo.commons.api.Constants;
/**
* Service document, represented via JSON.
@@ -34,34 +32,4 @@ public class JSONServiceDocumentImpl extends AbstractServiceDocument {
private static final long serialVersionUID = 4195734928526398830L;
- private String metadata;
-
- @Override
- public URI getBaseURI() {
- URI baseURI = null;
- if (metadata != null) {
- final String metadataURI = getMetadata();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
- }
-
- return baseURI;
- }
-
- /**
- * Gets the metadata URI.
- *
- * @return the metadata URI
- */
- public String getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final String metadata) {
- this.metadata = metadata;
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
index 682f500..e09b092 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
@@ -20,7 +20,6 @@ package org.apache.olingo.client.core.data.v3;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.core.data.AbstractServiceDocument;
@@ -28,21 +27,4 @@ import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
@JsonDeserialize(using = XMLServiceDocumentDeserializer.class)
public class XMLServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
-
- private URI baseURI;
-
- @Override
- public URI getBaseURI() {
- return this.baseURI;
- }
-
- /**
- * Sets base URI.
- *
- * @param baseURI base URI.
- */
- public void setBaseURI(final URI baseURI) {
- this.baseURI = baseURI;
- }
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
index 47f294f..45ce766 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.core.data.v4;
-import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@@ -27,12 +26,6 @@ import org.apache.olingo.client.api.data.ServiceDocumentItem;
public abstract class AbstractServiceDocument
extends org.apache.olingo.client.core.data.AbstractServiceDocument {
- private URI baseURI;
-
- private String metadataContext;
-
- private String metadataETag;
-
private List<ServiceDocumentItem> functionImports = new ArrayList<ServiceDocumentItem>();
private List<ServiceDocumentItem> singletons = new ArrayList<ServiceDocumentItem>();
@@ -40,38 +33,6 @@ public abstract class AbstractServiceDocument
private List<ServiceDocumentItem> relatedServiceDocuments = new ArrayList<ServiceDocumentItem>();
@Override
- public URI getBaseURI() {
- return this.baseURI;
- }
-
- /**
- * Sets base URI.
- *
- * @param baseURI base URI.
- */
- public void setBaseURI(final URI baseURI) {
- this.baseURI = baseURI;
- }
-
- @Override
- public String getMetadataContext() {
- return metadataContext;
- }
-
- public void setMetadataContext(final String metadataContext) {
- this.metadataContext = metadataContext;
- }
-
- @Override
- public String getMetadataETag() {
- return metadataETag;
- }
-
- public void setMetadataETag(final String metadataETag) {
- this.metadataETag = metadataETag;
- }
-
- @Override
public List<ServiceDocumentItem> getFunctionImports() {
return functionImports;
}
@@ -85,5 +46,4 @@ public abstract class AbstractServiceDocument
public List<ServiceDocumentItem> getRelatedServiceDocuments() {
return relatedServiceDocuments;
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
index b5c352b..f3dfd91 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
@@ -23,21 +23,6 @@ import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.net.URI;
-import org.apache.olingo.commons.api.Constants;
-
@JsonDeserialize(using = JSONServiceDocumentDeserializer.class)
public class JSONServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
-
- @Override
- public URI getBaseURI() {
- URI baseURI = null;
- if (getMetadataContext() != null) {
- final String metadataURI = getMetadataContext();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
- }
-
- return baseURI;
- }
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
index 2885658..b3c64b6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
@@ -25,5 +25,4 @@ import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
@JsonDeserialize(using = XMLServiceDocumentDeserializer.class)
public class XMLServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index c41ad6b..c9b6b0e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -292,7 +292,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final CommonODataEntity entity = resource.getSelfLink() == null
? client.getObjectFactory().newEntity(resource.getType())
: client.getObjectFactory().newEntity(resource.getType(),
- URIUtils.getURI(base, resource.getSelfLink().getHref()));
+ URIUtils.getURI(base, resource.getSelfLink().getHref()));
if (StringUtils.isNotBlank(resource.getETag())) {
entity.setETag(resource.getETag());
@@ -321,12 +321,12 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
entity.addLink(client.getObjectFactory().newInlineEntity(
link.getTitle(), base, link.getHref(),
getODataEntity(inlineEntry,
- inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
+ inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
} else {
entity.addLink(client.getObjectFactory().newInlineEntitySet(
link.getTitle(), base, link.getHref(),
getODataEntitySet(inlineFeed,
- inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
+ inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
}
}
@@ -363,18 +363,18 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setText(resource.getValue().asPrimitive().get()).
setType(typeInfo == null
- ? null
- : EdmPrimitiveTypeKind.valueOfFQN(
- client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
+ ? null
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isGeospatial()) {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setValue(resource.getValue().asGeospatial().get()).
setType(typeInfo == null
- || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
- || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
- ? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
- : EdmPrimitiveTypeKind.valueOfFQN(
- client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
+ ? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isComplex()) {
value = client.getObjectFactory().newComplexValue(typeInfo == null
? null : typeInfo.getFullQualifiedName().toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/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 4f4a484..226d8b8 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
@@ -64,19 +64,19 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
- serviceDocument.setMetadataContext(URIUtils.getURI(resource.getBaseURI(), resource.getMetadataContext()));
- serviceDocument.setMetadataETag(resource.getMetadataETag());
-
for (ServiceDocumentItem functionImport : resource.getFunctionImports()) {
- serviceDocument.getFunctionImports().put(functionImport.getTitle(),
+ serviceDocument.getFunctionImports().put(
+ functionImport.getName() == null ? functionImport.getHref() : functionImport.getName(),
URIUtils.getURI(resource.getBaseURI(), functionImport.getHref()));
}
for (ServiceDocumentItem singleton : resource.getSingletons()) {
- serviceDocument.getSingletons().put(singleton.getTitle(),
+ serviceDocument.getSingletons().put(
+ singleton.getName() == null ? singleton.getHref() : singleton.getName(),
URIUtils.getURI(resource.getBaseURI(), singleton.getHref()));
}
for (ServiceDocumentItem sdoc : resource.getRelatedServiceDocuments()) {
- serviceDocument.getRelatedServiceDocuments().put(sdoc.getTitle(),
+ serviceDocument.getRelatedServiceDocuments().put(
+ sdoc.getName() == null ? sdoc.getHref() : sdoc.getName(),
URIUtils.getURI(resource.getBaseURI(), sdoc.getHref()));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 01e0d7b..04ad089 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -97,7 +97,6 @@ public class AsyncTestITCase extends AbstractTestITCase {
* @see MediaEntityTest#createMediaEntity(com.msopentech.odatajclient.engine.format.ODataPubFormat)
*/
@Test
- @Ignore
public void createMediaEntity() throws Exception {
CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
deleted file mode 100644
index 1972fec..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ /dev/null
@@ -1,534 +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.it.v3;
-
-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.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
-import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
-import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.domain.v3.ODataEntity;
-import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.v3.ODataProperty;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
-
- // create navigation link with ATOM
- @Test
- public void createNavWithAtom() {
- final ODataPubFormat format = ODataPubFormat.ATOM;
- final String contentType = "application/atom+xml";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 20, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // create navigation link with JSON full metadata
-
- @Test
- public void createNavWithJSONFullMetadata() {
- final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final String contentType = "application/json;odata=fullmetadata";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 21, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // throws Null pointer exception when the format is JSON No metadata
-
- @Test(expected = HttpClientException.class)
- public void createNavWithJSONNoMetadata() {
- final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
- final String contentType = "application/json;odata=nometadata";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 22, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // test with JSON accept and atom content type
-
- @Test
- @Ignore
- public void createNavWithJSONAndATOM() {
- final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final String contentType = "application/atom+xml";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 23, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // test with JSON full metadata in format and json no metadata in content type
-
- @Test
- public void createNavWithDiffJSON() {
- final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final String contentType = "application/json;odata=nometadata";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 24, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // test with JSON no metadata format and json no metadata in content type
-
- @Test(expected = HttpClientException.class)
- public void createNavWithNoMetadata() {
- final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
- final String contentType = "application/json;odata=fullmetadata";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 25, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // create collection navigation link with ATOM
-
- @Test
- public void createCollectionNavWithAtom() throws EdmPrimitiveTypeException {
- final ODataPubFormat format = ODataPubFormat.ATOM;
- final String contentType = "application/atom+xml";
- final String prefer = "return-content";
- final ODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // create collection navigation link with JSON
-
- @Test
- public void createCollectionNavWithJSON() throws EdmPrimitiveTypeException {
- final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final String contentType = "application/json;odata=fullmetadata";
- final String prefer = "return-content";
- final ODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
-
- // create a navigation link
- public ODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
- final String prefer) {
- final String name = "Customer Navigation test";
-
- final ODataEntity original = getNewCustomer(id, name, false);
- original.addLink(client.getObjectFactory().newEntityNavigationLink(
- "Info", URI.create(testStaticServiceRootURL + "/CustomerInfo(11)")));
- final ODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
- prefer);
-
- final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
-
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
- uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
-
- final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
- req.setContentType(contenttype);
- req.setPrefer(prefer);
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
- assertTrue(res.getHeader("DataServiceVersion").contains("3.0;"));
- final ODataEntity entity = res.getBody();
- assertNotNull(entity);
- for (ODataProperty prop : entity.getProperties()) {
- if ("CustomerInfoId".equals(prop.getName())) {
- assertEquals("11", prop.getValue().toString());
- }
- }
- return actual;
- }
-
- // create a navigation link
- public ODataEntity createNav(final String url, final ODataPubFormat format, final ODataEntity original,
- final String entitySetName, final String contentType, final String prefer) {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(url);
- uriBuilder.appendEntitySetSegment(entitySetName);
- final ODataEntityCreateRequest<ODataEntity> createReq =
- client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
- createReq.setFormat(format);
- createReq.setContentType(contentType);
- createReq.setPrefer(prefer);
- final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
- assertEquals(201, createRes.getStatusCode());
-
- assertEquals("Created", createRes.getStatusMessage());
-
- final ODataEntity created = createRes.getBody();
- assertNotNull(created);
- return created;
- }
- // create collection navigation link
-
- public ODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
- final String contentType, final String prefer) throws EdmPrimitiveTypeException {
- {
- final String name = "Collection Navigation Key Customer";
- final ODataEntity original = getNewCustomer(id, name, false);
-
- final Set<Integer> navigationKeys = new HashSet<Integer>();
- navigationKeys.add(-118);
- navigationKeys.add(-119);
-
- for (Integer key : navigationKeys) {
- final ODataEntity orderEntity =
- client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
-
- getClient().getBinder().add(orderEntity,
- client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- getClient().getBinder().add(orderEntity,
- client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
- setType(EdmPrimitiveTypeKind.Int32).build()));
-
- final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest(
- client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
- orderEntity);
- createReq.setFormat(format);
- createReq.setContentType(contentType);
- original.addLink(client.getObjectFactory().newEntitySetNavigationLink(
- "Orders",
- createReq.execute().getBody().getEditLink()));
- }
- final ODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
- contentType, prefer);
- final ODataEntity actualEntity =
- validateEntities(testStaticServiceRootURL, format, createdEntity, id, null, "Customer");
-
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
- uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
-
- final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
- getEntitySetRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final ODataEntitySet entitySet = res.getBody();
- assertNotNull(entitySet);
-
- assertEquals(2, entitySet.getCount());
-
- for (ODataEntity entity : entitySet.getEntities()) {
- final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
- final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
- assertTrue(navigationKeys.contains(key));
- assertEquals(Integer.valueOf(id), customerId);
- navigationKeys.remove(key);
- final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(
- URIUtils.getURI(testStaticServiceRootURL, entity.getEditLink().toASCIIString()));
-
- deleteReq.setFormat(format);
- assertEquals(204, deleteReq.execute().getStatusCode());
- }
-
- return actualEntity;
- }
- }
- // get a Customer entity to be created
-
- public ODataEntity getNewCustomer(
- final int id, final String name, final boolean withInlineInfo) {
-
- final ODataEntity entity =
- client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
-
- // add name attribute
- getClient().getBinder().add(entity,
- client.getObjectFactory().newPrimitiveProperty("Name",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(name).
- setType(EdmPrimitiveTypeKind.String).build()));
-
- // add key attribute
- if (id != 0) {
- getClient().getBinder().add(entity,
- client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- }
- final ODataCollectionValue<ODataValue> backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
- "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
-
- final ODataComplexValue<ODataProperty> contactDetails = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
-
- final ODataCollectionValue<ODataValue> altNamesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- altNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
- setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
- contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
-
- final ODataCollectionValue<ODataValue> emailBagValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- emailBagValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
- setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
- contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
-
- final ODataComplexValue<ODataProperty> contactAliasValue = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
- contactDetails.add(client.getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
-
- final ODataCollectionValue<ODataValue> aliasAltNamesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- aliasAltNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
- setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
- contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
-
- final ODataComplexValue<ODataProperty> homePhone = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
- homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
- client.getObjectFactory().newPrimitiveValueBuilder().setText("8437568356834568").
- setType(EdmPrimitiveTypeKind.String).build()));
- homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension",
- client.getObjectFactory().newPrimitiveValueBuilder().setText("124365426534621534423ttrf").
- setType(EdmPrimitiveTypeKind.String).
- build()));
- contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
-
- backupContactInfoValue.add(contactDetails);
- getClient().getBinder().add(entity,
- client.getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
- if (withInlineInfo) {
- final ODataInlineEntity inlineInfo = client.getObjectFactory().newInlineEntity("Info", URI.create(
- "Customer(" + id
- + ")/Info"), getInfo(id, name + "_Info"));
- inlineInfo.getEntity().setMediaEntity(true);
- entity.addLink(inlineInfo);
- }
-
- return entity;
- }
- //delete an entity and associated links after creation
-
- public void delete(final ODataPubFormat format, final ODataEntity created, final boolean includeInline,
- final String baseUri) {
- final Set<URI> toBeDeleted = new HashSet<URI>();
- toBeDeleted.add(created.getEditLink());
-
- if (includeInline) {
- for (ODataLink link : created.getNavigationLinks()) {
- if (link instanceof ODataInlineEntity) {
- final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
- if (inline.getEditLink() != null) {
- toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
- }
- }
-
- if (link instanceof ODataInlineEntitySet) {
- final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
- for (CommonODataEntity entity : inline.getEntities()) {
- if (entity.getEditLink() != null) {
- toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
- }
- }
- }
- }
- }
- assertFalse(toBeDeleted.isEmpty());
-
- for (URI link : toBeDeleted) {
- final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(link);
- final ODataDeleteResponse deleteRes = deleteReq.execute();
-
- assertEquals(204, deleteRes.getStatusCode());
- assertEquals("No Content", deleteRes.getStatusMessage());
-
- deleteRes.close();
- }
- }
- // add Information property
-
- public ODataEntity getInfo(final int id, final String info) {
- final ODataEntity entity =
- client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
- entity.setMediaEntity(true);
-
- getClient().getBinder().add(entity, client.getObjectFactory().newPrimitiveProperty("Information",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(info).
- setType(EdmPrimitiveTypeKind.String).build()));
- return entity;
- }
- // validate newly created entities
-
- public ODataEntity validateEntities(final String serviceRootURL,
- final ODataPubFormat format,
- final ODataEntity original,
- final int actualObjectId,
- final Collection<String> expands, final String entitySetName) {
-
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(serviceRootURL).
- appendEntitySetSegment(entitySetName).appendKeySegment(actualObjectId);
-
- if (expands != null) {
- for (String expand : expands) {
- uriBuilder.expand(expand);
- }
- }
- final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final ODataEntity actual = res.getBody();
- assertNotNull(actual);
-
- validateLinks(original.getAssociationLinks(), actual.getAssociationLinks());
- validateLinks(original.getEditMediaLinks(), actual.getEditMediaLinks());
- validateLinks(original.getNavigationLinks(), actual.getNavigationLinks());
-
- checkProperties(original.getProperties(), actual.getProperties());
- return actual;
- }
- // compares links of the newly created entity with the previous
-
- public void validateLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
- assertTrue(original.size() <= actual.size());
-
- for (ODataLink originalLink : original) {
- ODataLink foundOriginal = null;
- ODataLink foundActual = null;
-
- for (ODataLink actualLink : actual) {
-
- if (actualLink.getType() == originalLink.getType()
- && (originalLink.getLink() == null
- || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString()))
- && actualLink.getName().equals(originalLink.getName())) {
-
- foundOriginal = originalLink;
- foundActual = actualLink;
- }
- }
-
- assertNotNull(foundOriginal);
- assertNotNull(foundActual);
-
- if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
- final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
- assertNotNull(originalInline);
-
- final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
- assertNotNull(actualInline);
-
- checkProperties(originalInline.getProperties(), actualInline.getProperties());
- }
- }
- }
- // compares properties of the newly created entity with the properties that were originally provided
-
- @Override
- public void checkProperties(final Collection<? extends CommonODataProperty> original,
- final Collection<? extends CommonODataProperty> actual) {
-
- assertTrue(original.size() <= actual.size());
-
- final Map<String, CommonODataProperty> actualProperties = new HashMap<String, CommonODataProperty>(actual.size());
-
- for (CommonODataProperty prop : actual) {
- assertFalse(actualProperties.containsKey(prop.getName()));
- actualProperties.put(prop.getName(), prop);
- }
-
- assertTrue(actual.size() <= actualProperties.size());
-
- for (CommonODataProperty prop : original) {
- assertNotNull(prop);
- if (actualProperties.containsKey(prop.getName())) {
- final CommonODataProperty actualProp = actualProperties.get(prop.getName());
- assertNotNull(actualProp);
-
- if (prop.getValue() != null && actualProp.getValue() != null) {
- checkPropertyValue(prop.getName(), prop.getValue(), actualProp.getValue());
- }
- }
- }
- }
- // compares property value of the newly created entity with the property value that were originally provided
-
- @Override
- public void checkPropertyValue(final String propertyName,
- final ODataValue original, final ODataValue actual) {
-
- assertNotNull("Null original value for " + propertyName, original);
- assertNotNull("Null actual value for " + propertyName, actual);
-
- assertEquals("Type mismatch for '" + propertyName + "'",
- original.getClass().getSimpleName(), actual.getClass().getSimpleName());
-
- if (original.isComplex()) {
- final List<CommonODataProperty> originalPropertyValue = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : original.asComplex()) {
- originalPropertyValue.add(prop);
- }
-
- final List<CommonODataProperty> actualPropertyValue = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : actual.asComplex()) {
- actualPropertyValue.add(prop);
- }
-
- checkProperties(originalPropertyValue, actualPropertyValue);
- } else if (original.isCollection()) {
- assertTrue(original.asCollection().size() <= actual.asCollection().size());
-
- boolean found = original.asCollection().isEmpty();
-
- for (ODataValue originalValue : original.asCollection()) {
- for (ODataValue actualValue : actual.asCollection()) {
- try {
- checkPropertyValue(propertyName, originalValue, actualValue);
- found = true;
- } catch (AssertionError error) {
- }
- }
- }
-
- assertTrue("Found " + actual + " and expected " + original, found);
- } else {
- assertTrue("Primitive value for '" + propertyName + "' type mismatch",
- original.asPrimitive().getTypeKind() == actual.asPrimitive().getTypeKind());
-
- assertEquals("Primitive value for '" + propertyName + "' mismatch",
- original.asPrimitive().toString(), actual.asPrimitive().toString());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index f98e12a..0204f78 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -253,7 +253,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
private void updateCollectionProperty(final ODataFormat format) throws IOException {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
- uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-9).
+ uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-10).
appendPropertySegment("PrimaryContactInfo").appendPropertySegment("AlternativeNames");
ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory().
@@ -277,7 +277,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final ODataPropertyUpdateRequest updateReq =
client.getCUDRequestFactory().getPropertyCollectionValueUpdateRequest(uriBuilder.build(),
- alternativeNames);
+ alternativeNames);
if (client.getConfiguration().isUseXHTTPMethod()) {
assertEquals(HttpMethod.POST, updateReq.getMethod());
} else {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
index 989dd98..94e316f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
import java.net.URI;
import java.util.LinkedHashMap;
@@ -42,7 +43,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.junit.Ignore;
+
import org.junit.Test;
/**
@@ -70,7 +71,13 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
assertEquals(getServiceRoot() + "/Customers(PersonID=1)", entity.getEditLink().toASCIIString());
assertEquals(3, entity.getNavigationLinks().size());
- assertTrue(entity.getAssociationLinks().isEmpty());
+
+ if (ODataPubFormat.ATOM == format) {
+ assertTrue(entity.getAssociationLinks().isEmpty());
+ } else {
+ // In JSON, association links for each $ref link will exist.
+ assertFalse(entity.getAssociationLinks().isEmpty());
+ }
boolean found = false;
@@ -106,7 +113,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void withInlineEntryFromJSON() {
// this needs to be full, otherwise there is no mean to recognize links
withInlineEntry(ODataPubFormat.JSON_FULL_METADATA);
@@ -144,7 +150,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void withInlineFeedFromJSON() {
// this needs to be full, otherwise there is no mean to recognize links
withInlineFeed(ODataPubFormat.JSON_FULL_METADATA);
@@ -173,7 +178,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void rawRequestAsJSON() {
// this needs to be full, otherwise actions will not be provided
rawRequest(ODataPubFormat.JSON_FULL_METADATA);
@@ -203,7 +207,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void multiKeyAsJSON() throws EdmPrimitiveTypeException {
multiKey(ODataPubFormat.JSON_FULL_METADATA);
}
@@ -214,7 +217,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void checkForETagAsJSON() {
checkForETag(ODataPubFormat.JSON_FULL_METADATA);
}
@@ -237,9 +239,8 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test(expected = IllegalArgumentException.class)
- @Ignore
public void issue99() {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Orders");
final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.JSON);
@@ -255,7 +256,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void retrieveEntityViaReferenceAsJSON() {
retrieveEntityViaReference(ODataPubFormat.JSON_FULL_METADATA);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index bc0905c..c120415 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -36,7 +36,6 @@ import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -54,7 +53,6 @@ public class EntitySetTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void rawRequestAsJSON() throws IOException {
rawRequest(ODataPubFormat.JSON);
}
@@ -65,19 +63,16 @@ public class EntitySetTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void readODataEntitySetIteratorFromJSON() {
readODataEntitySetIterator(ODataPubFormat.JSON);
}
@Test
- @Ignore
public void readODataEntitySetIteratorFromJSONFullMeta() {
readODataEntitySetIterator(ODataPubFormat.JSON_FULL_METADATA);
}
@Test
- @Ignore
public void readODataEntitySetIteratorFromJSONNoMeta() {
readODataEntitySetIterator(ODataPubFormat.JSON_NO_METADATA);
}
@@ -88,7 +83,6 @@ public class EntitySetTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void readODataEntitySetWithNextFromJSON() {
readEntitySetWithNextLink(ODataPubFormat.JSON_FULL_METADATA);
}
@@ -126,7 +120,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
- final ODataEntitySetIterator feedIterator = res.getBody();
+ final ODataEntitySetIterator<ODataEntitySet, ODataEntity> feedIterator = res.getBody();
assertNotNull(feedIterator);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
index 7a28ed1..133c929 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceD
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Ignore;
import org.junit.Test;
public class ServiceDocumentTestITCase extends AbstractTestITCase {
@@ -40,9 +39,9 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase {
assertEquals(200, res.getStatusCode());
final ODataServiceDocument serviceDocument = res.getBody();
- assertEquals(12, serviceDocument.getEntitySetTitles().size());
- assertEquals(6, serviceDocument.getSingletonTitles().size());
- assertEquals(6, serviceDocument.getFunctionImportTitles().size());
+ assertEquals(12, serviceDocument.getEntitySets().size());
+ assertEquals(6, serviceDocument.getSingletons().size());
+ assertEquals(6, serviceDocument.getFunctionImports().size());
assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
assertEquals(URI.create(testStaticServiceRootURL + "/ProductDetails"),
@@ -59,7 +58,6 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void retrieveServiceDocumentAsJSON() {
retrieveServiceDocument(ODataFormat.JSON);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
index 4dc4fae..08067ab 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
@@ -23,11 +23,13 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.net.URI;
+import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.data.Container;
import org.junit.Test;
public class ServiceDocumentTest extends AbstractTest {
@@ -42,13 +44,18 @@ public class ServiceDocumentTest extends AbstractTest {
}
private ODataServiceDocument parse(final ODataFormat format) {
- final ODataServiceDocument serviceDocument = getClient().getReader().readServiceDocument(
+ Container<ServiceDocument> service = getClient().getDeserializer().toServiceDocument(
getClass().getResourceAsStream("serviceDocument." + getFileExtension(format)), format);
+
+ assertEquals(URI.create("http://host/service/$metadata"), service.getContextURL());
+ assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", service.getMetadataETag());
+
+ final ODataServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getObject());
assertNotNull(serviceDocument);
- assertEquals(URI.create("http://host/service/$metadata"), serviceDocument.getMetadataContext());
+
assertTrue(serviceDocument.getEntitySetTitles().contains("Order Details"));
assertEquals(URI.create("http://host/service/TopProducts"),
- serviceDocument.getFunctionImportURI("Best-Selling Products"));
+ serviceDocument.getFunctionImportURI("TopProducts"));
assertEquals(URI.create("http://host/HR/"),
serviceDocument.getRelatedServiceDocumentsURIs().iterator().next());
@@ -63,6 +70,5 @@ public class ServiceDocumentTest extends AbstractTest {
@Test
public void xml() {
final ODataServiceDocument serviceDocument = parse(ODataFormat.XML);
- assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", serviceDocument.getMetadataETag());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
index 2e7f066..a51cd30 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
@@ -1,5 +1,6 @@
{
"@odata.context": "http://host/service/$metadata",
+ "@odata.metadataEtag": "W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"",
"value": [
{
"name": "Orders",
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
index 13f807b..281bd18 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
@@ -25,10 +25,6 @@ import java.util.Map;
public class ODataServiceDocument {
- private URI metadataContext;
-
- private String metadataETag;
-
private final Map<String, URI> entitySets = new HashMap<String, URI>();
private final Map<String, URI> functionImports = new HashMap<String, URI>();
@@ -37,22 +33,6 @@ public class ODataServiceDocument {
private final Map<String, URI> relatedServiceDocuments = new HashMap<String, URI>();
- public URI getMetadataContext() {
- return metadataContext;
- }
-
- public void setMetadataContext(final URI metadataContext) {
- this.metadataContext = metadataContext;
- }
-
- public String getMetadataETag() {
- return metadataETag;
- }
-
- public void setMetadataETag(final String metadataETag) {
- this.metadataETag = metadataETag;
- }
-
public Map<String, URI> getEntitySets() {
return entitySets;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
index 4ba9671..6731259 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@ -25,12 +25,13 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataPropertyType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
+abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Container<T>> {
private JSONGeoValueDeserializer geoDeserializer;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
index ef3eaf1..8abd3f3 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -22,6 +22,7 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -33,6 +34,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.ODataOperation;
@@ -58,7 +60,10 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
if (inline instanceof ObjectNode) {
link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
- link.setInlineEntry(inline.traverse(codec).readValuesAs(JSONEntryImpl.class).next());
+
+ link.setInlineEntry(inline.traverse(codec).<Container<JSONEntryImpl>>readValueAs(
+ new TypeReference<JSONEntryImpl>() {
+ }).getObject());
}
if (inline instanceof ArrayNode) {
@@ -67,7 +72,9 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
final JSONFeedImpl feed = new JSONFeedImpl();
final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
while (entries.hasNext()) {
- feed.getEntries().add(entries.next().traverse(codec).readValuesAs(JSONEntryImpl.class).next());
+ feed.getEntries().add(entries.next().traverse(codec).<Container<JSONEntryImpl>>readValuesAs(
+ new TypeReference<JSONEntryImpl>() {
+ }).next().getObject());
}
link.setInlineFeed(feed);
@@ -77,7 +84,7 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
}
@Override
- protected JSONEntryImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<JSONEntryImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
@@ -86,18 +93,30 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation());
}
+ final String metadataETag;
+ final URI contextURL;
final JSONEntryImpl entry = new JSONEntryImpl();
- String contextURL = null;
+ if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
+ metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
+ tree.remove(Constants.JSON_METADATA_ETAG);
+ } else {
+ metadataETag = null;
+ }
+
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
+ contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- contextURL = tree.get(Constants.JSON_METADATA).textValue();
+ contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
}
+
if (contextURL != null) {
- entry.setBaseURI(contextURL.substring(0, contextURL.indexOf(Constants.METADATA)));
+ String url = contextURL.toASCIIString();
+ entry.setBaseURI(url.substring(0, url.indexOf(Constants.METADATA)));
}
if (tree.hasNonNull(jsonETag)) {
@@ -237,6 +256,6 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
}
}
- return entry;
+ return new Container<JSONEntryImpl>(contextURL, metadataETag, entry);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
index d278a34..3c180b9 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
@@ -20,6 +20,7 @@ package org.apache.olingo.commons.core.data;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -27,6 +28,7 @@ import java.io.IOException;
import java.net.URI;
import java.util.Iterator;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
/**
* Reads JSON string into a feed.
@@ -36,7 +38,7 @@ import org.apache.olingo.commons.api.Constants;
public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl> {
@Override
- protected JSONFeedImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<JSONFeedImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
@@ -45,16 +47,29 @@ public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl>
return null;
}
+ final String metadataETag;
+ final URI contextURL;
final JSONFeedImpl feed = new JSONFeedImpl();
+ if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
+ metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
+ tree.remove(Constants.JSON_METADATA_ETAG);
+ } else {
+ metadataETag = null;
+ }
+
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- feed.setContextURL(URI.create(tree.get(Constants.JSON_CONTEXT).textValue()));
+ contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- feed.setContextURL(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
+ contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
}
+ feed.setMetadataContextURL(contextURL);
+
if (tree.hasNonNull(Constants.JSON_COUNT)) {
feed.setCount(tree.get(Constants.JSON_COUNT).asInt());
}
@@ -64,10 +79,13 @@ public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl>
if (tree.hasNonNull(Constants.VALUE)) {
for (final Iterator<JsonNode> itor = tree.get(Constants.VALUE).iterator(); itor.hasNext();) {
- feed.getEntries().add(itor.next().traverse(parser.getCodec()).readValueAs(JSONEntryImpl.class));
+ feed.getEntries().add(
+ itor.next().traverse(parser.getCodec()).<Container<JSONEntryImpl>>readValueAs(
+ new TypeReference<JSONEntryImpl>() {
+ }).getObject());
}
}
- return feed;
+ return new Container<JSONFeedImpl>(contextURL, metadataETag, feed);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
index 8994e88..0a4db73 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
@@ -38,7 +38,7 @@ public class JSONFeedImpl extends AbstractPayloadObject implements Feed {
private static final long serialVersionUID = -3576372289800799417L;
- private URI contextURL;
+ private URI metadataContextURL;
private String id;
@@ -51,16 +51,16 @@ public class JSONFeedImpl extends AbstractPayloadObject implements Feed {
@Override
public URI getBaseURI() {
URI baseURI = null;
- if (contextURL != null) {
- final String metadataURI = contextURL.toASCIIString();
+ if (metadataContextURL != null) {
+ final String metadataURI = metadataContextURL.toASCIIString();
baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
}
return baseURI;
}
- public void setContextURL(final URI context) {
- this.contextURL = context;
+ public void setMetadataContextURL(final URI metadataContextURL) {
+ this.metadataContextURL = metadataContextURL;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
index f033de1..de3ffa1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
@@ -25,11 +25,12 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODataErrorImpl> {
@Override
- protected JSONODataErrorImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<JSONODataErrorImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final JSONODataErrorImpl error = new JSONODataErrorImpl();
@@ -54,7 +55,6 @@ public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODa
}
}
- return error;
+ return new Container<JSONODataErrorImpl>(null, null, error);
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 737ed53..381b6d4 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -23,8 +23,10 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
+import java.net.URI;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
/**
* Parse JSON string into <tt>JSONPropertyImpl</tt>.
@@ -34,27 +36,35 @@ import org.apache.olingo.commons.api.Constants;
public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPropertyImpl> {
@Override
- protected JSONPropertyImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<JSONPropertyImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
+ final String metadataETag;
+ final URI contextURL;
final JSONPropertyImpl property = new JSONPropertyImpl();
+ if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
+ metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
+ tree.remove(Constants.JSON_METADATA_ETAG);
+ } else {
+ metadataETag = null;
+ }
+
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- final String contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
- property.setName(StringUtils.substringAfterLast(contextURL, "/"));
+ contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
+ property.setName(StringUtils.substringAfterLast(contextURL.toASCIIString(), "/"));
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- final String metadata = tree.get(Constants.JSON_METADATA).textValue();
- final int dashIdx = metadata.lastIndexOf('#');
- if (dashIdx != -1) {
- property.setType(metadata.substring(dashIdx + 1));
- }
+ contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
+ property.setType(StringUtils.substringAfterLast(contextURL.toASCIIString(), "#"));
tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
}
- if (tree.has(jsonType) && property.getType() == null) {
+ if (tree.has(jsonType)) {
property.setType(tree.get(jsonType).asText());
}
@@ -66,6 +76,6 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPrope
value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : tree);
}
- return property;
+ return new Container<JSONPropertyImpl>(contextURL, metadataETag, property);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
index 9249055..c393bb5 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
@@ -22,7 +22,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.Point;
public final class EdmGeographyMultiPoint extends AbstractGeospatialType<MultiPoint> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
index 3c5a0e2..3000e84 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
@@ -22,7 +22,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.Point;
public final class EdmGeometryCollection extends AbstractGeospatialType<GeospatialCollection> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index 616766b..96043c7 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -18,9 +18,11 @@
*/
package org.apache.olingo.commons.core.op;
+import com.fasterxml.jackson.core.type.TypeReference;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.lang.reflect.Type;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLOutputFactory;
@@ -101,10 +103,9 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
writer.flush();
writer.close();
- return (Container<T>) atomDeserializer.getContainer(
- start, getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference));
+ final V obj = getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference);
+ return (Container<T>) (obj instanceof Container ? obj : atomDeserializer.getContainer(start, obj));
} catch (Exception e) {
- e.printStackTrace();
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
@@ -119,7 +120,14 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
protected <T, V extends T> Container<T> json(final InputStream input, final Class<V> reference) {
try {
- return new Container<T>(null, null, getObjectMapper().readValue(input, reference));
+ T obj = getObjectMapper().readValue(input, new TypeReference<V>() {
+ @Override
+ public Type getType() {
+ return reference;
+ }
+ });
+
+ return obj instanceof Container ? (Container<T>) obj : new Container<T>(null, null, obj);
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
[39/51] [abbrv] git commit: [OLINGO-206] merge master
Posted by sk...@apache.org.
[OLINGO-206] merge master
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/929fb655
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/929fb655
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/929fb655
Branch: refs/heads/olingo-206-validator
Commit: 929fb655604652b27466ef38533e961e5dcb4611
Parents: 2f7a865 793c56e
Author: Stephan Klevenz <st...@sap.com>
Authored: Wed Apr 2 09:43:09 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Wed Apr 2 09:43:09 2014 +0200
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 91 +-
.../java/org/apache/olingo/fit/V4NorthWind.java | 47 +
.../org/apache/olingo/fit/V4NorthWindExt.java | 48 +
.../java/org/apache/olingo/fit/V4Services.java | 3 +-
.../olingo/fit/utils/AbstractJSONUtilities.java | 100 +-
.../olingo/fit/utils/AbstractUtilities.java | 76 +-
.../olingo/fit/utils/AbstractXMLUtilities.java | 180 ++-
.../org/apache/olingo/fit/utils/Commons.java | 54 +-
.../apache/olingo/fit/utils/ConstantKey.java | 67 +
.../org/apache/olingo/fit/utils/Constants.java | 161 +-
.../olingo/fit/utils/MetadataLinkInfo.java | 22 +
.../apache/olingo/fit/utils/ODataVersion.java | 2 +-
.../utils/ResolvingReferencesInterceptor.java | 57 +
.../fit/utils/XHTTPMethodInterceptor.java | 5 +-
.../olingo/fit/utils/XMLEventReaderWrapper.java | 21 +-
.../org/apache/olingo/fit/utils/XmlElement.java | 20 +-
.../olingo/fit/utils/v3/XMLUtilities.java | 7 +-
.../olingo/fit/utils/v4/XMLUtilities.java | 7 +-
.../main/resources/v4/Company/entity.full.json | 38 +
fit/src/main/resources/v4/Company/entity.xml | 49 +
.../resources/v4/Customers/1/entity.full.json | 67 +
.../main/resources/v4/Customers/1/entity.xml | 67 +
.../v4/Customers/1/links/Company.full.json | 4 +
.../resources/v4/Customers/1/links/Company.xml | 22 +
.../v4/Customers/1/links/Orders.full.json | 10 +
.../resources/v4/Customers/1/links/Orders.xml | 25 +
.../main/resources/v4/Orders/8/entity.full.json | 23 +
fit/src/main/resources/v4/Orders/8/entity.xml | 50 +
fit/src/main/resources/v4/Orders/8/etag.txt | 1 +
.../main/resources/v4/Orders/8/links/.full.json | 4 +
.../Orders/8/links/CustomerForOrder.full.json | 4 +
.../v4/Orders/8/links/CustomerForOrder.xml | 22 +
fit/src/main/resources/v4/Orders/feed.full.json | 48 +
fit/src/main/resources/v4/Orders/feed.xml | 72 +
.../main/resources/v4/People/5/entity.full.json | 51 +
fit/src/main/resources/v4/People/5/entity.xml | 55 +
.../v4/ProductDetails/6 1/entity.full.json | 19 +
.../resources/v4/ProductDetails/6 1/entity.xml | 41 +
fit/src/main/resources/v4/badRequest.json | 17 +
fit/src/main/resources/v4/badRequest.xml | 30 +
.../main/resources/v4/northwind-metadata.xml | 91 ++
.../main/resources/v4/northwindExt-metadata.xml | 408 +++++
fit/src/main/resources/v4/notFound.json | 11 +
fit/src/main/resources/v4/notFound.xml | 25 +
...JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json | 4 +
.../T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml | 22 +
fit/src/main/resources/v4/services.full.json | 126 ++
fit/src/main/resources/v4/services.xml | 102 ++
.../main/resources/v4/unsupportedMediaType.json | 17 +
.../main/resources/v4/unsupportedMediaType.xml | 34 +
.../main/webapp/WEB-INF/applicationContext.xml | 4 +-
.../olingo/client/api/CommonODataClient.java | 10 +-
.../ODataClientErrorException.java | 31 +-
.../api/communication/header/HeaderName.java | 111 +-
.../communication/header/ODataHeaderValues.java | 45 -
.../communication/header/ODataPreferences.java | 424 +++++
.../api/communication/request/ODataRequest.java | 24 +-
.../api/communication/request/UpdateType.java | 55 -
.../request/cud/CommonCUDRequestFactory.java | 20 +-
.../request/cud/ODataEntityCreateRequest.java | 8 +-
.../communication/request/cud/UpdateType.java | 31 +
.../request/cud/v3/UpdateType.java | 56 +
.../request/cud/v4/UpdateType.java | 52 +
.../retrieve/CommonRetrieveRequestFactory.java | 83 +-
.../request/retrieve/EdmMetadataRequest.java | 28 +
.../request/retrieve/ODataEntityRequest.java | 4 +-
.../retrieve/ODataEntitySetIteratorRequest.java | 5 +-
.../request/retrieve/ODataEntitySetRequest.java | 9 +-
.../request/retrieve/ODataMetadataRequest.java | 28 -
.../request/retrieve/ODataPropertyRequest.java | 4 +-
.../request/retrieve/XMLMetadataRequest.java | 29 +
.../retrieve/v3/RetrieveRequestFactory.java | 22 +-
.../retrieve/v4/RetrieveRequestFactory.java | 21 +
.../response/ODataEntityCreateResponse.java | 9 +-
.../response/ODataEntityUpdateResponse.java | 4 +-
.../ODataMediaEntityCreateResponse.java | 4 +-
.../ODataMediaEntityUpdateResponse.java | 4 +-
.../response/ODataPropertyUpdateResponse.java | 4 +-
.../communication/response/ODataResponse.java | 25 +
.../olingo/client/api/data/ServiceDocument.java | 15 -
.../api/domain/ODataEntitySetIterator.java | 26 +-
.../client/api/op/ClientODataDeserializer.java | 3 +-
.../olingo/client/api/op/CommonODataBinder.java | 33 +-
.../olingo/client/api/op/CommonODataReader.java | 28 +-
.../olingo/client/api/op/ODataWriter.java | 14 +-
.../olingo/client/api/op/v3/ODataBinder.java | 22 +
.../client/api/op/v3/ODataDeserializer.java | 3 +-
.../olingo/client/api/op/v3/ODataReader.java | 13 +
.../olingo/client/api/op/v4/ODataBinder.java | 21 +
.../olingo/client/api/op/v4/ODataReader.java | 14 +
.../olingo/client/api/uri/CommonURIBuilder.java | 13 +-
.../olingo/client/api/uri/SegmentType.java | 1 +
.../olingo/client/api/uri/v3/URIBuilder.java | 3 +-
.../olingo/client/api/uri/v4/URIBuilder.java | 39 +-
.../olingo/client/api/v3/ODataClient.java | 10 +-
.../olingo/client/api/v4/ODataClient.java | 10 +-
.../olingo/client/core/AbstractODataClient.java | 21 -
.../communication/request/ODataRequestImpl.java | 55 +-
.../request/cud/AbstractCUDRequestFactory.java | 22 +-
.../cud/ODataEntityCreateRequestImpl.java | 31 +-
.../cud/ODataEntityUpdateRequestImpl.java | 18 +-
.../cud/ODataPropertyUpdateRequestImpl.java | 18 +-
.../cud/ODataValueUpdateRequestImpl.java | 4 +-
.../request/invoke/ODataInvokeRequestImpl.java | 28 +-
.../invoke/v3/InvokeRequestFactoryImpl.java | 18 +-
.../retrieve/AbstractMetadataRequestImpl.java | 52 +
.../retrieve/AbstractODataRetrieveRequest.java | 4 +
.../AbstractRetrieveRequestFactory.java | 39 +-
.../retrieve/EdmMetadataRequestImpl.java | 73 +
.../retrieve/ODataEntityRequestImpl.java | 23 +-
.../ODataEntitySetIteratorRequestImpl.java | 16 +-
.../retrieve/ODataEntitySetRequestImpl.java | 29 +-
.../retrieve/ODataMetadataRequestImpl.java | 108 --
.../retrieve/ODataPropertyRequestImpl.java | 22 +-
.../request/retrieve/ODataRawRequestImpl.java | 10 +-
.../ODataServiceDocumentRequestImpl.java | 6 +-
.../request/retrieve/ODataValueRequestImpl.java | 4 +-
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 40 +-
.../retrieve/v3/XMLMetadataRequestImpl.java | 79 +
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 42 +-
.../retrieve/v4/XMLMetadataRequestImpl.java | 122 ++
.../ODataMediaEntityCreateRequestImpl.java | 11 +-
.../ODataMediaEntityUpdateRequestImpl.java | 11 +-
.../response/AbstractODataResponse.java | 40 +
.../core/data/AbstractServiceDocument.java | 33 +-
.../data/JSONServiceDocumentDeserializer.java | 37 +-
.../data/XMLServiceDocumentDeserializer.java | 33 +-
.../core/data/v3/JSONServiceDocumentImpl.java | 32 -
.../core/data/v3/XMLServiceDocumentImpl.java | 18 -
.../core/data/v4/AbstractServiceDocument.java | 40 -
.../core/data/v4/JSONServiceDocumentImpl.java | 15 -
.../core/data/v4/XMLServiceDocumentImpl.java | 1 -
.../core/domain/ODataGeospatialValueImpl.java | 130 --
.../core/domain/ODataPrimitiveValueImpl.java | 177 --
.../edm/AbstractEdmServiceMetadataImpl.java | 24 +-
.../client/core/edm/EdmBindingTargetImpl.java | 39 +-
.../olingo/client/core/edm/EdmClientImpl.java | 46 +-
.../client/core/edm/EdmEntityContainerImpl.java | 57 +-
.../olingo/client/core/edm/EdmEnumTypeImpl.java | 4 +-
.../core/edm/EdmNavigationPropertyImpl.java | 35 +-
.../olingo/client/core/edm/EdmSchemaImpl.java | 9 +-
.../client/core/edm/EdmTypeDefinitionImpl.java | 2 +-
.../client/core/edm/v3/EdmEntitySetProxy.java | 18 +-
.../core/edm/v3/EdmServiceMetadataImpl.java | 9 +-
.../core/edm/v4/EdmServiceMetadataImpl.java | 24 +-
.../client/core/edm/xml/v4/XMLMetadataImpl.java | 1 +
.../client/core/op/AbstractODataBinder.java | 171 +-
.../client/core/op/AbstractODataReader.java | 78 +-
.../olingo/client/core/op/ODataWriterImpl.java | 20 +-
.../client/core/op/impl/v3/ODataBinderImpl.java | 68 +
.../core/op/impl/v3/ODataDeserializerImpl.java | 17 +-
.../client/core/op/impl/v3/ODataReaderImpl.java | 47 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 132 +-
.../core/op/impl/v4/ODataDeserializerImpl.java | 7 +-
.../client/core/op/impl/v4/ODataReaderImpl.java | 28 +-
.../core/uri/AbstractFilterArgFactory.java | 9 +-
.../client/core/uri/AbstractFilterFactory.java | 7 +
.../client/core/uri/AbstractURIBuilder.java | 78 +-
.../olingo/client/core/uri/FilterLiteral.java | 10 +-
.../olingo/client/core/uri/ParameterAlias.java | 48 +
.../apache/olingo/client/core/uri/URIUtils.java | 257 ++-
.../core/uri/v3/FilterArgFactoryImpl.java | 5 +
.../client/core/uri/v3/FilterFactoryImpl.java | 7 +-
.../client/core/uri/v3/URIBuilderImpl.java | 12 +-
.../core/uri/v4/FilterArgFactoryImpl.java | 5 +
.../client/core/uri/v4/FilterFactoryImpl.java | 7 +-
.../client/core/uri/v4/URIBuilderImpl.java | 41 +-
.../olingo/client/core/v3/ODataClientImpl.java | 13 +-
.../olingo/client/core/v4/ODataClientImpl.java | 17 +-
.../client/core/AbstractPrimitiveTest.java | 429 -----
.../client/core/AbstractPropertyTest.java | 175 --
.../apache/olingo/client/core/AbstractTest.java | 10 -
.../core/it/AbstractMetadataTestITCase.java | 7 +-
.../client/core/it/AbstractTestITCase.java | 550 -------
.../client/core/it/v3/AbstractTestITCase.java | 530 +++++-
.../client/core/it/v3/AsyncTestITCase.java | 22 +-
.../core/it/v3/EntityCreateTestITCase.java | 135 +-
.../core/it/v3/EntityRetrieveTestITCase.java | 43 +-
.../client/core/it/v3/EntitySetTestITCase.java | 19 +-
.../core/it/v3/EntityUpdateTestITCase.java | 29 +-
.../client/core/it/v3/ErrorTestITCase.java | 14 +-
.../core/it/v3/FilterFactoryTestITCase.java | 4 +-
.../client/core/it/v3/FilterTestITCase.java | 4 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 10 +-
.../client/core/it/v3/LinkTestITCase.java | 2 +-
.../core/it/v3/MediaEntityTestITCase.java | 8 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 521 ------
.../client/core/it/v3/OpenTypeTestITCase.java | 168 +-
.../core/it/v3/PrimitiveKeysTestITCase.java | 8 +-
.../core/it/v3/PropertyRetrieveTestITCase.java | 41 +-
.../client/core/it/v3/PropertyTestITCase.java | 45 +-
.../core/it/v3/PropertyValueTestITCase.java | 24 +-
.../core/it/v3/QueryOptionsTestITCase.java | 40 +-
.../v3/ServiceDocumentRetrieveTestITCase.java | 73 -
.../client/core/it/v4/AbstractTestITCase.java | 3 +-
.../core/it/v4/EntityCreateTestITCase.java | 82 +
.../core/it/v4/EntityRetrieveTestITCase.java | 288 ++++
.../client/core/it/v4/EntitySetTestITCase.java | 30 +-
.../client/core/it/v4/MetadataTestITCase.java | 22 +-
.../core/it/v4/PropertyValueTestITCase.java | 145 ++
.../core/it/v4/ServiceDocumentTestITCase.java | 64 +
.../olingo/client/core/uri/URIEscapeTest.java | 79 +
.../client/core/uri/v3/FilterFactoryTest.java | 167 ++
.../client/core/uri/v3/URIBuilderTest.java | 162 ++
.../client/core/uri/v4/FilterFactoryTest.java | 86 +
.../client/core/uri/v4/URIBuilderTest.java | 152 ++
.../apache/olingo/client/core/v3/AtomTest.java | 10 +-
.../olingo/client/core/v3/EntitySetTest.java | 7 +-
.../olingo/client/core/v3/EntityTest.java | 31 +-
.../apache/olingo/client/core/v3/ErrorTest.java | 6 +-
.../client/core/v3/FilterFactoryTest.java | 167 --
.../apache/olingo/client/core/v3/JSONTest.java | 53 +-
.../olingo/client/core/v3/MetadataTest.java | 4 +-
.../client/core/v3/PrimitiveValueTest.java | 123 +-
.../olingo/client/core/v3/PropertyTest.java | 166 ++
.../olingo/client/core/v3/URIBuilderTest.java | 131 --
.../apache/olingo/client/core/v4/AtomTest.java | 74 +
.../olingo/client/core/v4/EntitySetTest.java | 91 ++
.../olingo/client/core/v4/EntityTest.java | 250 +++
.../apache/olingo/client/core/v4/ErrorTest.java | 61 +
.../client/core/v4/FilterFactoryTest.java | 86 -
.../apache/olingo/client/core/v4/JSONTest.java | 173 ++
.../olingo/client/core/v4/MetadataTest.java | 5 +-
.../client/core/v4/PrimitiveValueTest.java | 4 +-
.../olingo/client/core/v4/PropertyTest.java | 138 ++
.../client/core/v4/ServiceDocumentTest.java | 14 +-
.../olingo/client/core/v4/URIBuilderTest.java | 136 --
.../apache/olingo/client/core/atom_cleanup.xsl | 48 -
.../core/v3/Customer_-10_BackupContactInfo.json | 219 ++-
.../core/v3/Customer_-10_BackupContactInfo.xml | 397 ++++-
.../client/core/v3/Customer_-10_CustomerId.xml | 4 +-
.../v3/Customer_-10_PrimaryContactInfo.json | 45 +-
.../core/v3/Customer_-10_PrimaryContactInfo.xml | 82 +-
.../olingo/client/core/v3/atom_cleanup.xsl | 48 +
.../org/apache/olingo/client/core/v3/error.xml | 2 +-
...ccounts_101_expand_MyPaymentInstruments.json | 94 ++
...Accounts_101_expand_MyPaymentInstruments.xml | 129 ++
...ts_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json | 16 +
...nts_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml | 46 +
.../apache/olingo/client/core/v4/Customers.json | 57 +
.../apache/olingo/client/core/v4/Customers.xml | 106 ++
.../client/core/v4/Employees_3_HomeAddress.json | 6 +
.../client/core/v4/Employees_3_HomeAddress.xml | 31 +
.../olingo/client/core/v4/PersonDetails_1.json | 22 +
.../olingo/client/core/v4/PersonDetails_1.xml | 55 +
.../olingo/client/core/v4/Products_5.json | 29 +
.../apache/olingo/client/core/v4/Products_5.xml | 49 +
.../client/core/v4/Products_5_CoverColors.json | 5 +
.../client/core/v4/Products_5_CoverColors.xml | 30 +
.../client/core/v4/Products_5_SkinColor.json | 5 +
.../client/core/v4/Products_5_SkinColor.xml | 27 +
.../olingo/client/core/v4/VipCustomer.json | 50 +
.../olingo/client/core/v4/VipCustomer.xml | 73 +
.../olingo/client/core/v4/atom_cleanup.xsl | 48 +
.../core/v4/collectionOfEntityReferences.json | 11 +
.../core/v4/collectionOfEntityReferences.xml | 25 +
.../olingo/client/core/v4/complexProperty.json | 8 -
.../core/v4/entity.collection.complex.json | 14 +
.../core/v4/entity.collection.primitive.json | 7 +
.../olingo/client/core/v4/entity.complex.json | 12 +
.../olingo/client/core/v4/entity.full.json | 22 +
.../olingo/client/core/v4/entity.minimal.json | 15 +
.../olingo/client/core/v4/entity.primitive.json | 22 +
.../olingo/client/core/v4/entityReference.json | 4 +
.../olingo/client/core/v4/entityReference.xml | 22 +
.../org/apache/olingo/client/core/v4/error.json | 14 +
.../org/apache/olingo/client/core/v4/error.xml | 31 +
.../olingo/client/core/v4/fromdoc1-metadata.xml | 2 +-
.../olingo/client/core/v4/fullEntity.json | 22 -
.../olingo/client/core/v4/fullEntitySet.json | 29 -
.../core/v4/fullEntitySetWithTwoEntities.json | 49 -
...fullEntityWithCollectionOfComplexValues.json | 28 -
.../client/core/v4/primitiveNullValue.json | 3 -
.../olingo/client/core/v4/serviceDocument.json | 1 +
.../client/core/v4/setOfComplexProperties.json | 13 -
.../core/v4/setOfPrimitiveProperties.json | 8 -
.../apache/olingo/commons/api/Constants.java | 53 +-
.../olingo/commons/api/data/Container.java | 76 +
.../apache/olingo/commons/api/data/Entry.java | 23 +-
.../olingo/commons/api/data/EnumValue.java | 25 +
.../apache/olingo/commons/api/data/Feed.java | 1 -
.../olingo/commons/api/data/GeoUtils.java | 9 +-
.../apache/olingo/commons/api/data/Value.java | 8 +-
.../api/domain/AbstractODataPayload.java | 52 +
.../commons/api/domain/AbstractODataValue.java | 44 +-
.../commons/api/domain/CommonODataEntity.java | 215 +++
.../api/domain/CommonODataEntitySet.java | 57 +
.../api/domain/CommonODataObjectFactory.java | 210 +++
.../commons/api/domain/CommonODataProperty.java | 77 +
.../api/domain/ODataCollectionValue.java | 66 +-
.../commons/api/domain/ODataComplexValue.java | 61 +-
.../olingo/commons/api/domain/ODataEntity.java | 316 ----
.../commons/api/domain/ODataEntitySet.java | 120 --
.../olingo/commons/api/domain/ODataError.java | 28 +-
.../api/domain/ODataGeospatialValue.java | 57 -
.../commons/api/domain/ODataInlineEntity.java | 8 +-
.../api/domain/ODataInlineEntitySet.java | 8 +-
.../olingo/commons/api/domain/ODataItem.java | 26 +-
.../olingo/commons/api/domain/ODataLink.java | 10 +-
.../commons/api/domain/ODataObjectFactory.java | 218 ---
.../commons/api/domain/ODataProperty.java | 186 ---
.../commons/api/domain/ODataPropertyType.java | 8 +-
.../api/domain/ODataServiceDocument.java | 20 -
.../olingo/commons/api/domain/ODataValue.java | 27 +-
.../commons/api/domain/v3/ODataEntity.java | 32 +
.../commons/api/domain/v3/ODataEntitySet.java | 29 +
.../api/domain/v3/ODataObjectFactory.java | 58 +
.../commons/api/domain/v3/ODataProperty.java | 41 +
.../commons/api/domain/v4/ODataEntity.java | 52 +
.../commons/api/domain/v4/ODataEntitySet.java | 29 +
.../commons/api/domain/v4/ODataEnumValue.java | 24 +
.../api/domain/v4/ODataObjectFactory.java | 62 +
.../commons/api/domain/v4/ODataProperty.java | 54 +
.../commons/api/domain/v4/ODataValue.java | 36 +
.../commons/api/edm/EdmBindingTarget.java | 7 +
.../commons/api/edm/EdmEntityContainer.java | 5 +
.../olingo/commons/api/edm/EdmEnumType.java | 5 +
.../commons/api/edm/EdmGeospatialType.java | 34 -
.../commons/api/edm/EdmNavigationProperty.java | 27 +-
.../api/edm/EdmNavigationPropertyBinding.java | 28 +
.../api/edm/EdmReferentialConstraint.java | 28 +
.../api/edm/constants/ODataServiceVersion.java | 71 +
.../commons/api/edm/geo/ComposedGeospatial.java | 22 +-
.../olingo/commons/api/edm/geo/Geospatial.java | 36 +-
.../api/edm/geo/GeospatialCollection.java | 15 +-
.../olingo/commons/api/edm/geo/LineString.java | 4 +-
.../commons/api/edm/geo/MultiLineString.java | 8 +-
.../olingo/commons/api/edm/geo/MultiPoint.java | 4 +-
.../commons/api/edm/geo/MultiPolygon.java | 8 +-
.../olingo/commons/api/edm/geo/Point.java | 8 +-
.../olingo/commons/api/edm/geo/Polygon.java | 18 +-
.../olingo/commons/api/format/ContentType.java | 28 +-
.../olingo/commons/api/format/ODataFormat.java | 36 +-
.../commons/api/format/ODataPubFormat.java | 31 +-
.../commons/api/op/CommonODataDeserializer.java | 8 +-
.../commons/core/data/AbstractAtomDealer.java | 36 +-
.../commons/core/data/AbstractAtomObject.java | 78 -
.../olingo/commons/core/data/AbstractEntry.java | 14 +-
.../core/data/AbstractJsonDeserializer.java | 28 +-
.../core/data/AbstractJsonSerializer.java | 16 +-
.../commons/core/data/AbstractODataError.java | 58 +
.../commons/core/data/AbstractODataObject.java | 81 +
.../commons/core/data/AbstractProperty.java | 80 +
.../commons/core/data/AbstractPropertyImpl.java | 80 -
.../olingo/commons/core/data/AbstractValue.java | 17 +-
.../commons/core/data/AtomDeserializer.java | 329 ++--
.../olingo/commons/core/data/AtomFeedImpl.java | 2 +-
.../core/data/AtomGeoValueDeserializer.java | 46 +-
.../core/data/AtomGeoValueSerializer.java | 4 +-
.../core/data/AtomPropertyDeserializer.java | 54 +-
.../commons/core/data/AtomPropertyImpl.java | 2 +-
.../core/data/AtomPropertySerializer.java | 42 +-
.../commons/core/data/AtomSerializer.java | 38 +-
.../olingo/commons/core/data/EnumValueImpl.java | 41 +
.../core/data/JSONEntryDeserializer.java | 118 +-
.../olingo/commons/core/data/JSONEntryImpl.java | 59 -
.../commons/core/data/JSONEntrySerializer.java | 8 +-
.../commons/core/data/JSONErrorBundle.java | 50 -
.../olingo/commons/core/data/JSONErrorImpl.java | 237 ---
.../commons/core/data/JSONFeedDeserializer.java | 39 +-
.../olingo/commons/core/data/JSONFeedImpl.java | 26 +-
.../commons/core/data/JSONFeedSerializer.java | 9 +-
.../core/data/JSONGeoValueDeserializer.java | 73 +-
.../core/data/JSONGeoValueSerializer.java | 8 +-
.../core/data/JSONODataErrorDeserializer.java | 60 +
.../commons/core/data/JSONODataErrorImpl.java | 26 +
.../core/data/JSONPropertyDeserializer.java | 38 +-
.../commons/core/data/JSONPropertyImpl.java | 22 +-
.../core/data/JSONPropertySerializer.java | 12 +-
.../core/data/ODataJacksonDeserializer.java | 42 +
.../commons/core/data/PrimitiveValueImpl.java | 2 +-
.../olingo/commons/core/data/XMLErrorImpl.java | 213 ---
.../commons/core/data/XMLODataErrorImpl.java | 23 +
.../domain/AbstractODataCollectionValue.java | 92 ++
.../core/domain/AbstractODataComplexValue.java | 93 ++
.../core/domain/AbstractODataEntity.java | 268 ++++
.../core/domain/AbstractODataEntitySet.java | 73 +
.../core/domain/AbstractODataObjectFactory.java | 115 ++
.../domain/AbstractODataPrimitiveValue.java | 179 +++
.../core/domain/AbstractODataProperty.java | 147 ++
.../domain/v3/ODataCollectionValueImpl.java | 32 +
.../core/domain/v3/ODataComplexValueImpl.java | 32 +
.../commons/core/domain/v3/ODataEntityImpl.java | 46 +
.../core/domain/v3/ODataEntitySetImpl.java | 51 +
.../core/domain/v3/ODataObjectFactoryImpl.java | 96 ++
.../core/domain/v3/ODataPrimitiveValueImpl.java | 44 +
.../core/domain/v3/ODataPropertyImpl.java | 45 +
.../domain/v4/ODataCollectionValueImpl.java | 42 +
.../core/domain/v4/ODataComplexValueImpl.java | 44 +
.../commons/core/domain/v4/ODataEntityImpl.java | 62 +
.../core/domain/v4/ODataEntitySetImpl.java | 51 +
.../core/domain/v4/ODataEnumValueImpl.java | 50 +
.../core/domain/v4/ODataObjectFactoryImpl.java | 107 ++
.../core/domain/v4/ODataPrimitiveValueImpl.java | 56 +
.../core/domain/v4/ODataPropertyImpl.java | 57 +
.../core/edm/AbstractEdmEntityContainer.java | 196 +--
.../commons/core/edm/AbstractEdmEnumType.java | 5 +
.../commons/core/edm/AbstractEdmParameter.java | 2 +-
.../edm/EdmNavigationPropertyBindingImpl.java | 43 +
.../core/edm/EdmReferentialConstraintImpl.java | 42 +
.../olingo/commons/core/edm/EdmTypeInfo.java | 1 -
.../AbstractEdmGeospatialType.java | 76 -
.../primitivetype/AbstractGeospatialType.java | 539 +++++++
.../core/edm/primitivetype/EdmGeography.java | 19 +-
.../primitivetype/EdmGeographyCollection.java | 33 +-
.../primitivetype/EdmGeographyLineString.java | 32 +-
.../EdmGeographyMultiLineString.java | 33 +-
.../primitivetype/EdmGeographyMultiPoint.java | 34 +-
.../primitivetype/EdmGeographyMultiPolygon.java | 32 +-
.../edm/primitivetype/EdmGeographyPoint.java | 29 +-
.../edm/primitivetype/EdmGeographyPolygon.java | 32 +-
.../core/edm/primitivetype/EdmGeometry.java | 19 +-
.../primitivetype/EdmGeometryCollection.java | 33 +-
.../primitivetype/EdmGeometryLineString.java | 32 +-
.../EdmGeometryMultiLineString.java | 33 +-
.../primitivetype/EdmGeometryMultiPoint.java | 33 +-
.../primitivetype/EdmGeometryMultiPolygon.java | 33 +-
.../edm/primitivetype/EdmGeometryPoint.java | 28 +-
.../edm/primitivetype/EdmGeometryPolygon.java | 32 +-
.../primitivetype/EdmPrimitiveTypeFactory.java | 31 +-
.../commons/core/edm/primitivetype/EdmTime.java | 5 +
.../core/op/AbstractODataDeserializer.java | 57 +-
.../commons/core/op/ODataObjectFactoryImpl.java | 162 --
.../primitivetype/CommonPrimitiveTypeTest.java | 170 +-
.../core/edm/primitivetype/EdmBinaryTest.java | 2 +-
.../core/edm/primitivetype/EdmBooleanTest.java | 2 +-
.../core/edm/primitivetype/EdmByteTest.java | 2 +-
.../core/edm/primitivetype/EdmDateTest.java | 2 +-
.../primitivetype/EdmDateTimeOffsetTest.java | 2 +-
.../core/edm/primitivetype/EdmDecimalTest.java | 16 +-
.../core/edm/primitivetype/EdmDoubleTest.java | 14 +-
.../core/edm/primitivetype/EdmDurationTest.java | 2 +-
.../core/edm/primitivetype/EdmGeoTest.java | 174 ++
.../core/edm/primitivetype/EdmGuidTest.java | 2 +-
.../core/edm/primitivetype/EdmInt16Test.java | 6 +-
.../core/edm/primitivetype/EdmInt32Test.java | 8 +-
.../core/edm/primitivetype/EdmInt64Test.java | 10 +-
.../core/edm/primitivetype/EdmNullTest.java | 20 +-
.../core/edm/primitivetype/EdmSByteTest.java | 2 +-
.../core/edm/primitivetype/EdmSingleTest.java | 12 +-
.../core/edm/primitivetype/EdmStringTest.java | 2 +-
.../edm/primitivetype/EdmTimeOfDayTest.java | 2 +-
.../core/edm/primitivetype/UInt7Test.java | 2 +-
.../apache/olingo/server/api/ODataFormat.java | 23 -
.../olingo/server/api/ODataSerializer.java | 31 -
.../apache/olingo/server/api/ODataServer.java | 2 +
.../server/api/serializer/ODataFormat.java | 23 +
.../server/api/serializer/ODataSerializer.java | 33 +
.../olingo/server/core/CircleStreamBuffer.java | 327 ----
.../olingo/server/core/ODataJsonSerializer.java | 147 --
.../olingo/server/core/ODataSerializerImpl.java | 38 -
.../olingo/server/core/ODataServerImpl.java | 10 +-
.../server/core/edm/provider/EdmActionImpl.java | 16 +-
.../core/edm/provider/EdmActionImportImpl.java | 16 +-
.../core/edm/provider/EdmBindingTargetImpl.java | 44 +-
.../core/edm/provider/EdmComplexTypeImpl.java | 20 +-
.../edm/provider/EdmEntityContainerImpl.java | 13 +-
.../core/edm/provider/EdmEntitySetImpl.java | 16 +-
.../core/edm/provider/EdmEntityTypeImpl.java | 22 +-
.../core/edm/provider/EdmEnumTypeImpl.java | 20 +-
.../core/edm/provider/EdmFunctionImpl.java | 16 +-
.../edm/provider/EdmKeyPropertyRefImpl.java | 16 +-
.../edm/provider/EdmNavigationPropertyImpl.java | 34 +-
.../edm/provider/EdmOperationImportImpl.java | 2 +-
.../core/edm/provider/EdmParameterImpl.java | 16 +-
.../core/edm/provider/EdmPropertyImpl.java | 16 +-
.../core/edm/provider/EdmReturnTypeImpl.java | 16 +-
.../server/core/edm/provider/EdmSchemaImpl.java | 2 +-
.../edm/provider/EdmServiceMetadataImpl.java | 18 +-
.../core/edm/provider/EdmSingletonImpl.java | 16 +-
.../provider/EdmStructuredTypeHelperImpl.java | 16 +-
.../edm/provider/EdmTypeDefinitionImpl.java | 2 +-
.../core/serializer/ODataJsonSerializer.java | 87 +
.../core/serializer/ODataXmlSerializerImpl.java | 72 +
.../json/ServiceDocumentJsonSerializer.java | 103 ++
.../serializer/utils/CircleStreamBuffer.java | 327 ++++
.../xml/MetadataDocumentXmlSerializer.java | 543 +++++++
.../olingo/server/core/uri/UriInfoImpl.java | 4 +-
.../server/core/uri/UriParameterImpl.java | 16 +-
.../server/core/uri/UriResourceActionImpl.java | 16 +-
.../uri/UriResourceComplexPropertyImpl.java | 16 +-
.../server/core/uri/UriResourceCountImpl.java | 16 +-
.../core/uri/UriResourceEntitySetImpl.java | 16 +-
.../core/uri/UriResourceFunctionImpl.java | 16 +-
.../olingo/server/core/uri/UriResourceImpl.java | 16 +-
.../server/core/uri/UriResourceItImpl.java | 16 +-
.../core/uri/UriResourceLambdaAllImpl.java | 16 +-
.../core/uri/UriResourceLambdaAnyImpl.java | 16 +-
.../core/uri/UriResourceLambdaVarImpl.java | 16 +-
.../uri/UriResourceNavigationPropertyImpl.java | 16 +-
.../uri/UriResourcePrimitivePropertyImpl.java | 16 +-
.../server/core/uri/UriResourceRefImpl.java | 16 +-
.../server/core/uri/UriResourceRootImpl.java | 16 +-
.../core/uri/UriResourceSingletonImpl.java | 16 +-
.../uri/UriResourceStartingTypeFilterImpl.java | 16 +-
.../server/core/uri/UriResourceTypedImpl.java | 16 +-
.../server/core/uri/UriResourceValueImpl.java | 16 +-
.../olingo/server/core/uri/parser/RawUri.java | 16 +-
.../server/core/uri/parser/UriContext.java | 33 +-
.../core/uri/parser/UriParseTreeVisitor.java | 37 +-
.../core/uri/parser/UriParserException.java | 16 +-
.../uri/parser/UriParserSemanticException.java | 16 +-
.../uri/parser/UriParserSyntaxException.java | 16 +-
.../uri/queryoption/AliasQueryOptionImpl.java | 16 +-
.../core/uri/queryoption/CountOptionImpl.java | 16 +-
.../uri/queryoption/CustomQueryOptionImpl.java | 16 +-
.../core/uri/queryoption/ExpandItemImpl.java | 28 +-
.../core/uri/queryoption/ExpandOptionImpl.java | 16 +-
.../core/uri/queryoption/FilterOptionImpl.java | 16 +-
.../core/uri/queryoption/FormatOptionImpl.java | 16 +-
.../core/uri/queryoption/IdOptionImpl.java | 16 +-
.../core/uri/queryoption/LevelsOptionImpl.java | 16 +-
.../core/uri/queryoption/OrderByItemImpl.java | 16 +-
.../core/uri/queryoption/OrderByOptionImpl.java | 16 +-
.../core/uri/queryoption/QueryOptionImpl.java | 16 +-
.../core/uri/queryoption/SearchOptionImpl.java | 16 +-
.../core/uri/queryoption/SelectItemImpl.java | 28 +-
.../core/uri/queryoption/SelectOptionImpl.java | 16 +-
.../core/uri/queryoption/SkipOptionImpl.java | 16 +-
.../uri/queryoption/SkipTokenOptionImpl.java | 16 +-
.../uri/queryoption/SystemQueryOptionImpl.java | 18 +-
.../core/uri/queryoption/TopOptionImpl.java | 17 +-
.../uri/queryoption/expression/AliasImpl.java | 16 +-
.../uri/queryoption/expression/BinaryImpl.java | 16 +-
.../queryoption/expression/EnumerationImpl.java | 16 +-
.../queryoption/expression/ExpressionImpl.java | 16 +-
.../queryoption/expression/LambdaRefImpl.java | 16 +-
.../uri/queryoption/expression/LiteralImpl.java | 16 +-
.../uri/queryoption/expression/MemberImpl.java | 28 +-
.../uri/queryoption/expression/MethodImpl.java | 16 +-
.../queryoption/expression/TypeLiteralImpl.java | 16 +-
.../uri/queryoption/expression/UnaryImpl.java | 16 +-
.../olingo/server/core/ServiceDocumentTest.java | 133 --
.../core/edm/provider/EdmActionImplTest.java | 18 +-
.../edm/provider/EdmActionImportImplTest.java | 2 -
.../edm/provider/EdmComplexTypeImplTest.java | 16 +-
.../provider/EdmEntityContainerImplTest.java | 100 +-
.../core/edm/provider/EdmEntitySetImplTest.java | 19 +-
.../edm/provider/EdmEntityTypeImplTest.java | 16 +-
.../server/core/edm/provider/EdmEnumTest.java | 18 +-
.../core/edm/provider/EdmFunctionImplTest.java | 18 +-
.../edm/provider/EdmFunctionImportImplTest.java | 18 +-
.../edm/provider/EdmKeyPropertyRefImplTest.java | 17 +-
.../core/edm/provider/EdmMemberImplTest.java | 20 +-
.../core/edm/provider/EdmNamedImplTest.java | 16 +-
.../provider/EdmNavigationPropertyImplTest.java | 18 +-
.../core/edm/provider/EdmParameterImplTest.java | 16 +-
.../core/edm/provider/EdmPropertyImplTest.java | 16 +-
.../EdmProviderImplOverloadingTest.java | 17 +-
.../core/edm/provider/EdmProviderImplTest.java | 17 +-
.../edm/provider/EdmReturnTypeImplTest.java | 20 +-
.../core/edm/provider/EdmSchemaImplTest.java | 33 +-
.../provider/EdmServiceMetadataImplTest.java | 17 +-
.../core/edm/provider/EdmSingletonImplTest.java | 19 +-
.../edm/provider/EdmTypeDefinitionImplTest.java | 18 +-
.../core/edm/provider/EdmTypeImplTest.java | 16 +-
.../serializer/json/ServiceDocumentTest.java | 133 ++
.../serializer/xml/MetadataDocumentTest.java | 57 +
.../core/testutil/EdmTechTestProvider.java | 24 +-
.../server/core/testutil/StringUtils.java | 4 +-
.../testutil/techprovider/ActionProvider.java | 191 +++
.../techprovider/ComplexTypeProvider.java | 175 ++
.../techprovider/ContainerProvider.java | 361 +++++
.../testutil/techprovider/EdmTechProvider.java | 147 ++
.../techprovider/EntityTypeProvider.java | 410 +++++
.../testutil/techprovider/EnumTypeProvider.java | 47 +
.../testutil/techprovider/FunctionProvider.java | 852 ++++++++++
.../testutil/techprovider/PropertyProvider.java | 590 +++++++
.../testutil/techprovider/SchemaProvider.java | 250 +++
.../techprovider/TypeDefinitionProvider.java | 30 +
.../olingo/server/core/uri/RawUriTest.java | 26 +-
.../olingo/server/core/uri/UriInfoImplTest.java | 23 +-
.../server/core/uri/UriResourceImplTest.java | 60 +-
.../core/uri/antlr/TestFullResourcePath.java | 1515 +++++++++---------
.../olingo/server/core/uri/antlr/TestLexer.java | 25 +-
.../core/uri/antlr/TestUriParserImpl.java | 310 ++--
.../core/uri/queryoption/QueryOptionTest.java | 34 +-
.../queryoption/expression/ExpressionTest.java | 57 +-
.../core/uri/testutil/ExpandValidator.java | 29 +-
.../core/uri/testutil/FilterTreeToText.java | 16 +-
.../core/uri/testutil/FilterValidator.java | 22 +-
.../core/uri/testutil/ParseTreeToText.java | 16 +-
.../core/uri/testutil/ParserValidator.java | 16 +-
.../core/uri/testutil/ParserWithLogging.java | 16 +-
.../core/uri/testutil/ResourceValidator.java | 50 +-
.../core/uri/testutil/TestErrorLogger.java | 16 +-
.../core/uri/testutil/TokenValidator.java | 16 +-
.../core/uri/testutil/UriLexerWithTrace.java | 16 +-
.../server/core/uri/testutil/UriValidator.java | 27 +-
.../server/core/uri/testutil/Validator.java | 16 +-
pom.xml | 18 +
591 files changed, 22528 insertions(+), 10350 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/929fb655/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --cc lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
index a5ec95b,eedefce..5992d90
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
@@@ -278,13 -289,8 +278,13 @@@ public class UriInfoImpl implements Uri
return this;
}
- public void removeResourcePart(int index) {
- this.pathParts.remove(index);
+ public void removeResourcePart(final int index) {
+ pathParts.remove(index);
+ }
+ @Override
+ public Collection<SystemQueryOption> getSystemQueryOptions() {
+ return Collections.unmodifiableCollection(systemQueryOptions.values());
}
+
}