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 025e4fed4..3d8051492 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; @@ -54,8 +52,10 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; 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; @@ -67,7 +67,7 @@ public abstract class AbstractServices { */ protected static final Logger LOG = LoggerFactory.getLogger(AbstractServices.class); - private static Set initialized = EnumSet.noneOf(ODataVersion.class); + private static final Set INITIALIZED = EnumSet.noneOf(ODataVersion.class); protected abstract ODataVersion getVersion(); protected final AbstractXMLUtilities xml; @@ -83,9 +83,9 @@ public abstract class AbstractServices { this.json = new org.apache.olingo.fit.utils.v4.JSONUtilities(); } - if (!initialized.contains(getVersion())) { + if (!INITIALIZED.contains(getVersion())) { xml.retrieveLinkInfoFromMetadata(); - initialized.add(getVersion()); + INITIALIZED.add(getVersion()); } } @@ -105,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); } @@ -120,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)); } /** @@ -132,17 +133,57 @@ 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))); } - private Response getMetadata(final String filename) { + protected Response getMetadata(final String filename) { try { - return xml. - createResponse(FSManager.instance(getVersion()).readFile(filename, Accept.XML), null, Accept.XML); + return xml.createResponse(FSManager.instance(getVersion()).readFile(filename, Accept.XML), null, Accept.XML); } catch (Exception e) { return xml.createFaultResponse(Accept.XML.toString(getVersion()), e); } } +// +// @GET +// @Path("/$entity") +// public Response getEntityReference(@QueryParam("$id") String id){ +// return null; +// } + + /** + * Retrieve entity reference sample. + * + * @param accept Accept header. + * @param path path. + * @param format format query option. + * @return entity reference or feed of entity reference. + */ + @GET + @Path("/{path:.*}/$ref") + public Response getEntityReference( + @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept, + @PathParam("path") String path, + @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) { + + try { + final Map.Entry utils = getUtilities(accept, format); + + if (utils.getKey() == Accept.TEXT) { + throw new UnsupportedMediaTypeException("Unsupported media type"); + } + + final String filename = Base64.encodeBase64String(path.getBytes("UTF-8")); + + return utils.getValue().createResponse( + FSManager.instance(getVersion()).readFile(Constants.get(getVersion(), ConstantKey.REF) + + File.separatorChar + filename, utils.getKey()), + null, + utils.getKey()); + } catch (Exception e) { + LOG.error("Error retrieving entity", e); + return xml.createFaultResponse(accept, e); + } + } @MERGE @Path("/{entitySetName}/{entityId}") @@ -378,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(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); @@ -483,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)) { @@ -548,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) { @@ -970,15 +1017,17 @@ public abstract class AbstractServices { final String basePath = Commons.getEntityBasePath(entitySetName, entityId); - InputStream stream = FSManager.instance(getVersion()).readFile( - basePath + ENTITY, acceptType == null || acceptType == Accept.TEXT - ? Accept.XML : acceptType); - final AbstractUtilities utils = getUtilities(acceptType); final List 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); diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java new file mode 100644 index 000000000..b11d3e593 --- /dev/null +++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.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.fit; + +import org.apache.olingo.fit.utils.ODataVersion; +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 org.apache.olingo.fit.utils.ConstantKey; +import org.apache.olingo.fit.utils.Constants; + +@Path("/V40/NorthWind.svc") +@InInterceptors(classes = XHTTPMethodInterceptor.class) +public class V4NorthWind extends AbstractServices { + + public V4NorthWind() throws Exception { + super(); + } + + @Override + protected ODataVersion getVersion() { + return ODataVersion.v4; + } + + @Override + public Response getMetadata() { + return getMetadata("northwind-" + Constants.get(getVersion(), ConstantKey.METADATA)); + } + +} diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java new file mode 100644 index 000000000..b5d4bda9e --- /dev/null +++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.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.fit; + +import org.apache.olingo.fit.utils.ODataVersion; +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 org.apache.olingo.fit.utils.ConstantKey; +import org.apache.olingo.fit.utils.Constants; +import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor; + +@Path("/V40/NorthWindExt.svc") +@InInterceptors(classes = {XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class}) +public class V4NorthWindExt extends AbstractServices { + + public V4NorthWindExt() throws Exception { + super(); + } + + @Override + protected ODataVersion getVersion() { + return ODataVersion.v4; + } + + @Override + public Response getMetadata() { + return getMetadata("northwindExt-" + Constants.get(getVersion(), ConstantKey.METADATA)); + } + +} diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java index 3fc5ddc61..327e82d37 100644 --- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java +++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java @@ -22,9 +22,10 @@ import org.apache.olingo.fit.utils.ODataVersion; import org.apache.olingo.fit.utils.XHTTPMethodInterceptor; import javax.ws.rs.Path; import org.apache.cxf.interceptor.InInterceptors; +import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor; @Path("/V40/Static.svc") -@InInterceptors(classes = XHTTPMethodInterceptor.class) +@InInterceptors(classes = {XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class}) public class V4Services extends AbstractServices { public V4Services() throws Exception { 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 c62d3419a..14fff0918 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,11 +59,11 @@ 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))); } - return IOUtils.toInputStream(srcNode.toString()); + return IOUtils.toInputStream(srcNode.toString(), "UTf-8"); } @Override @@ -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 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 hrefs = new ArrayList(); if (field.getValue().isArray()) { @@ -128,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")); } } @@ -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,10 +168,10 @@ 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()); + return IOUtils.toInputStream(srcNode.toString(), "UTf-8"); } @Override @@ -190,8 +188,9 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities { final String entitySetName, final String entityId, final List 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,23 +287,23 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities { final ObjectNode srcNode = (ObjectNode) mapper.readTree(src); final Set retain = new HashSet(); - 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); - return IOUtils.toInputStream(srcNode.toString()); + return IOUtils.toInputStream(srcNode.toString(), "UTf-8"); } @Override @@ -344,13 +345,14 @@ 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()); + return IOUtils.toInputStream(node.toString(), "UTf-8"); } @Override @@ -362,18 +364,18 @@ 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()); + return IOUtils.toInputStream(toBeChangedNode.toString(), "UTf-8"); } @Override @@ -386,7 +388,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities { final Iterator> fields = srcObject.fields(); while (fields.hasNext()) { final Map.Entry 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; @@ -404,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 @@ -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>(next == null ? null : next.asText(), links); } @@ -449,8 +451,8 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities { final ObjectNode srcNode = (ObjectNode) mapper.readTree(content); IOUtils.closeQuietly(content); - srcNode.set(JSON_EDITLINK_NAME, new TextNode(href)); - return IOUtils.toInputStream(srcNode.toString()); + srcNode.set(Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(href)); + return IOUtils.toInputStream(srcNode.toString(), "UTf-8"); } @Override @@ -479,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 @@ -498,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"); } } 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 7b74b6213..8df97e37b 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 = "" - + "" - + "" + DEFAULT_SERVICE_URL + entityURI + "" + + "" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entityURI + "" + "" + "" @@ -310,16 +311,18 @@ public abstract class AbstractUtilities { + ""; 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,25 +380,21 @@ 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)) { 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; @@ -411,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(); } @@ -426,7 +429,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; @@ -507,6 +510,19 @@ public abstract class AbstractUtilities { } } sequence.put(entitySetName, Integer.valueOf(res)); + } else if ("Orders".equals(entitySetName)) { + try { + final Map value = + getPropertyValues(entity, Collections.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 value = @@ -612,7 +628,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 +647,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 +661,7 @@ public abstract class AbstractUtilities { final String entitySetName, final String entityId, final String name) { final String basePath = Commons.getEntityBasePath(entitySetName, entityId); return new SimpleEntry(basePath, fsManager.readFile(basePath - + (name == null ? MEDIA_CONTENT_FILENAME : name))); + + (name == null ? Constants.get(version, ConstantKey.MEDIA_CONTENT_FILENAME) : name))); } public Map.Entry readEntity( @@ -654,7 +671,8 @@ public abstract class AbstractUtilities { } final String basePath = Commons.getEntityBasePath(entitySetName, entityId); - return new SimpleEntry(basePath, fsManager.readFile(basePath + ENTITY, accept)); + return new SimpleEntry(basePath, + fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), accept)); } public InputStream expandEntity( @@ -719,15 +737,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 +760,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( 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 d02e8289a..88349a9e6 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,15 +18,13 @@ */ 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; 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; @@ -77,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 { @@ -85,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) { @@ -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 linkInfo = - extractElement(reader, null, Collections.singletonList(LINK), startDepth, 2, 2); + extractElement(reader, null, + Collections.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 linkInfo = extractElement( - reader, null, Collections.singletonList(LINK), filter, true, startDepth, 2, 2); + reader, null, Collections.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.singletonList(INLINE), 0, -1, -1). + extractElement(link.getContentReader(), null, + Collections.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.singletonList(LINK), filter, true, + reader, writer, + Collections.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 + ")"); // ----------------------------------------- } @@ -364,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; @@ -380,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; } @@ -439,7 +446,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { try { // check edit link existence - extractElement(reader, writer, Collections.singletonList(LINK), + extractElement(reader, writer, Collections.singletonList(Constants.get(version, ConstantKey.LINK)), Collections.>singletonList( new AbstractMap.SimpleEntry("rel", "edit")), false, 0, -1, -1); @@ -518,7 +525,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { } else { try { final XmlElement entryElement = - extractElement(reader, writer, Collections.singletonList(PROPERTIES), 0, 2, 3).getValue(); + extractElement(reader, writer, Collections.singletonList( + Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3).getValue(); addAtomElement( IOUtils.toInputStream(""), @@ -564,9 +572,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 +585,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 +750,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { final List pathElements = new ArrayList(); 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 +781,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 +813,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; @@ -840,23 +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("".toCharArray()); if (forceFeed || links.size() > 1) { // build a feed - bos.write("".getBytes()); - bos.write(("") - .getBytes()); + .toCharArray()); - bos.write(("" + DEFAULT_SERVICE_URL + "entityset(entityid)/" + linkName + "").getBytes()); + writer.write(("" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "entityset(entityid)/" + linkName + + "").toCharArray()); - bos.write(("" + linkName + "").getBytes()); - bos.write("2014-03-03T13:40:49Z".getBytes()); - bos.write(("").getBytes()); + writer.write(("" + linkName + "").toCharArray()); + writer.write("2014-03-03T13:40:49Z".toCharArray()); + writer.write(("").toCharArray()); } for (String link : links) { @@ -870,7 +888,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { Collections.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); @@ -880,12 +898,15 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { if (forceFeed || links.size() > 1) { if (StringUtils.isNotBlank(next)) { - bos.write(String.format("", next).getBytes()); + writer.write(String.format("", next).toCharArray()); } - bos.write("".getBytes()); + writer.write("".toCharArray()); } + writer.flush(); + writer.close(); + return new ByteArrayInputStream(bos.toByteArray()); } @@ -901,7 +922,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray())); final Map.Entry propertyElement = - extractElement(reader, null, Collections.singletonList(PROPERTIES), 0, 2, 3); + extractElement(reader, null, + Collections.singletonList(Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3); reader.close(); reader = propertyElement.getValue().getContentReader(); @@ -924,9 +946,11 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { int pos = 0; while (true) { final Map.Entry linkElement = - extractElement(reader, null, Collections.singletonList(LINK), pos, 2, 2); + extractElement(reader, null, + Collections.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 +976,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { // add property changes // --------------------------------- Map.Entry propertyElement = - extractElement(reader, writer, Collections.singletonList(PROPERTIES), 0, 2, 3); + extractElement(reader, writer, + Collections.singletonList(Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3); writer.flush(); @@ -981,7 +1006,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { } for (Map.Entry 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 +1034,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { // remove existent links for (Map.Entry 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 +1043,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { try { final String linkName = remains.getKey().substring(remains.getKey().indexOf("]") + 1); - extractElement(reader, writer, Collections.singletonList(LINK), + extractElement(reader, writer, Collections.singletonList(Constants.get(version, ConstantKey.LINK)), Collections.>singleton(new SimpleEntry("title", linkName)), false, 0, 2, 2); @@ -1038,14 +1063,15 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { bos.reset(); writer = getEventWriter(bos); - propertyElement = extractElement(reader, writer, Collections.singletonList(CONTENT), 0, 2, 2); + propertyElement = extractElement(reader, writer, + Collections.singletonList(Constants.get(version, ConstantKey.CONTENT)), 0, 2, 2); writer.flush(); pbos.reset(); pwriter = new OutputStreamWriter(pbos); for (Map.Entry 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 +1110,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { try { final XmlElement linkElement = - extractElement(reader, writer, Collections.singletonList(LINK), + extractElement(reader, writer, + Collections.singletonList(Constants.get(version, ConstantKey.LINK)), Collections.>singletonList(new SimpleEntry("title", linkName)), false, 0, -1, -1).getValue(); writer.add(linkElement.getStart()); @@ -1116,23 +1143,26 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { public String getEdmTypeFromAtom(final String entitySetName, final String entityId, final List 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 atomPathElements = new ArrayList(); for (String element : path) { - atomPathElements.add(ATOM_PROPERTY_PREFIX + element); + atomPathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element); } final Map.Entry 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 +1219,12 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { final List pathElements = new ArrayList(); 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(); @@ -1205,14 +1236,20 @@ 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(ATOM_DATASERVICE_NS)) == null) { - writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), DATASERVICES_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(ATOM_METADATA_NS)) == null) { - writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), METADATA_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()); @@ -1232,7 +1269,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { final List pathElements = new ArrayList(); 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); @@ -1248,7 +1285,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); @@ -1273,7 +1319,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities { final List pathElements = new ArrayList(); 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); 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 dcc48074b..09a6db476 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; @@ -41,6 +39,7 @@ import java.util.List; import java.util.Map; import java.util.regex.Pattern; import org.apache.commons.io.IOUtils; +import org.codehaus.plexus.util.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,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"); @@ -79,11 +79,14 @@ public abstract class Commons { } public static String getEntityURI(final String entitySetName, final String entityKey) { - return entitySetName + "(" + entityKey + ")"; + // expected singleton in case of null key + return entitySetName + (StringUtils.isNotBlank(entityKey) ? "(" + entityKey + ")" : ""); } public static String getEntityBasePath(final String entitySetName, final String entityKey) { - return entitySetName + File.separatorChar + getEntityKey(entityKey) + File.separatorChar; + // expected singleton in case of null key + return entitySetName + File.separatorChar + + (StringUtils.isNotBlank(entityKey) ? getEntityKey(entityKey) + File.separatorChar : ""); } public static String getLinksURI( @@ -109,7 +112,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); } @@ -143,7 +147,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(""); } @@ -158,8 +162,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); @@ -168,7 +172,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)); } @@ -179,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) { @@ -193,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()); @@ -210,20 +214,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> fields = node.fields(); while (fields.hasNext()) { final Map.Entry 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)); @@ -266,8 +270,18 @@ public abstract class Commons { public static Map.Entry parseEntityURI(final String uri) { final String relPath = uri.substring(uri.lastIndexOf("/")); final int branchIndex = relPath.indexOf('('); - final String es = relPath.substring(0, branchIndex); - final String eid = relPath.substring(branchIndex + 1, relPath.indexOf(')')); + + final String es; + final String eid; + + if (branchIndex > -1) { + es = relPath.substring(0, branchIndex); + eid = relPath.substring(branchIndex + 1, relPath.indexOf(')')); + } else { + es = relPath; + eid = null; + } + return new SimpleEntry(es, eid); } } 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 000000000..3c46e94eb --- /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; + +}; 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 72309c226..ffd52bcff 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,90 +18,83 @@ */ package org.apache.olingo.fit.utils; +import java.util.EnumMap; +import java.util.Map; + public class Constants { - public final static String ODATA_SERVICE_VERSION = "DataServiceVersion"; + private final static Map v4constants = new EnumMap(ConstantKey.class); - public final static String DEFAULT_SERVICE_URL = "http://localhost:9080/StaticService/V30/Static.svc/"; + private final static Map constants = new EnumMap(ConstantKey.class); - public final static String ODATA_COUNT_NAME = "odata.count"; + static { - public final static String ODATA_METADATA_PREFIX = DEFAULT_SERVICE_URL + "$metadata#"; + // ----------------------------- + // 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#"); + // ----------------------------- - public final static String ATOM_DEF_TYPE = "Edm.String"; + // ----------------------------- + // 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 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 DATASERVICES_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices"; - - public final static String METADATA_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices/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 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 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); + } } diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java b/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java index 737fa7bdf..f18b8b818 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java @@ -28,6 +28,14 @@ public class MetadataLinkInfo { private Map entitySets = new HashMap(); + public void setSingleton(final String entitySetName) { + entitySets.get(entitySetName).setSingleton(true); + } + + public boolean isSingleton(final String entitySetName) { + return entitySets.get(entitySetName).isSingleton(); + } + public Set getEntitySets() { return entitySets.keySet(); } @@ -92,6 +100,8 @@ public class MetadataLinkInfo { private Set links; + private boolean singleton; + public EntitySet(final String name) { this.name = name; links = new HashSet(); @@ -135,6 +145,18 @@ public class MetadataLinkInfo { this.links = links; } + public EntitySet(boolean singleton) { + this.singleton = singleton; + } + + public boolean isSingleton() { + return singleton; + } + + public void setSingleton(boolean singleton) { + this.singleton = singleton; + } + @Override public String toString() { return name + ": " + links; 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 863bbd1e2..5b35d4d17 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; } -}; +} diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/ResolvingReferencesInterceptor.java b/fit/src/main/java/org/apache/olingo/fit/utils/ResolvingReferencesInterceptor.java new file mode 100644 index 000000000..4adac8a2c --- /dev/null +++ b/fit/src/main/java/org/apache/olingo/fit/utils/ResolvingReferencesInterceptor.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.fit.utils; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLDecoder; +import org.apache.commons.lang3.StringUtils; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Message; +import org.apache.cxf.phase.AbstractPhaseInterceptor; +import org.apache.cxf.phase.Phase; + +public class ResolvingReferencesInterceptor extends AbstractPhaseInterceptor { + + public ResolvingReferencesInterceptor() { + super(Phase.PRE_PROTOCOL); + } + + @Override + public void handleMessage(final Message message) throws Fault { + final String path = (String) message.get(Message.PATH_INFO); + final String query = (String) message.get(Message.QUERY_STRING); + + try { + if (path.endsWith("$entity") && StringUtils.isNotBlank(query) + && URLDecoder.decode(query, "UTF-8").contains("$id=")) { + final String id = URLDecoder.decode(query, "UTF-8"); + final String newURL = id.substring(id.indexOf("$id=") + 4); + + final URI uri = URI.create(newURL); + + message.put(Message.REQUEST_URL, uri.toASCIIString()); + message.put(Message.REQUEST_URI, uri.getPath()); + message.put(Message.PATH_INFO, uri.getPath()); + } + + } catch (UnsupportedEncodingException ignore) { + } + } +} 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 46fbd273b..bbcc489c8 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 { @SuppressWarnings("unchecked") final Map> headers = (Map>) 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()); } } } 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 6ba0ee927..f75f988d4 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); - this.wrapped = factory.createXMLEventReader( - new ByteArrayInputStream( - (XMLEventReaderWrapper.CONTENT_STAG - + IOUtils.toString(stream).replaceAll("^<\\?xml.*\\?>", "") - + XMLEventReaderWrapper.CONTENT_ETAG).getBytes())); + 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(reader); init(); } 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 e3e2bc8fb..850c862eb 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(); 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 c1a58bf95..919cee6a2 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 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); 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 c61d272b8..77c46becc 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); @@ -138,5 +139,9 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti if (size == 0) { metadataLinkInfo.addEntitySet(entitySetName); } + + if (singletons.contains(entitySetName)) { + metadataLinkInfo.setSingleton(entitySetName); + } } } diff --git a/fit/src/main/resources/v4/Company/entity.full.json b/fit/src/main/resources/v4/Company/entity.full.json new file mode 100644 index 000000000..41d4ffd2a --- /dev/null +++ b/fit/src/main/resources/v4/Company/entity.full.json @@ -0,0 +1,38 @@ +{ + "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Company", + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Company", + "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company", + "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company", + "CompanyID": 0, + "CompanyCategory@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory", + "CompanyCategory": "IT", + "Revenue@odata.type": "#Int64", + "Revenue": 100000, + "Name": "MS", + "Address": + { + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress", + "Street": "1 Microsoft Way", + "City": "Redmond", + "PostalCode": "98052", + "CompanyName": "Microsoft" + }, + "Employees@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Employees/$ref", + "Employees@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Employees", + "VipCustomer@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/VipCustomer/$ref", + "VipCustomer@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/VipCustomer", + "Departments@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Departments/$ref", + "Departments@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Departments", + "CoreDepartment@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/CoreDepartment/$ref", + "CoreDepartment@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/CoreDepartment", + "#Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue": + { + "title": "Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue", + "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue" + }, + "#Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount": + { + "title": "Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount", + "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount" + } +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/Company/entity.xml b/fit/src/main/resources/v4/Company/entity.xml new file mode 100644 index 000000000..6beed3b65 --- /dev/null +++ b/fit/src/main/resources/v4/Company/entity.xml @@ -0,0 +1,49 @@ + + + + http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company + + + + + + + + <updated>2014-03-24T17:09:31Z</updated> + <author> + <name /> + </author> + <content type="application/xml"> + <m:properties> + <d:CompanyID m:type="Int32">0</d:CompanyID> + <d:CompanyCategory m:type="#Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory">IT</d:CompanyCategory> + <d:Revenue m:type="Int64">100000</d:Revenue> + <d:Name>MS</d:Name> + <d:Address m:type="#Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress"> + <d:Street>1 Microsoft Way</d:Street> + <d:City>Redmond</d:City> + <d:PostalCode>98052</d:PostalCode> + <d:CompanyName>Microsoft</d:CompanyName> + </d:Address> + </m:properties> + </content> +</entry> \ No newline at end of file diff --git a/fit/src/main/resources/v4/Customers/1/entity.full.json b/fit/src/main/resources/v4/Customers/1/entity.full.json new file mode 100644 index 000000000..77ce0558c --- /dev/null +++ b/fit/src/main/resources/v4/Customers/1/entity.full.json @@ -0,0 +1,67 @@ +{ + "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Customers/$entity", + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer", + "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)", + "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/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@odata.type": "#GeographyPoint", + "Home": + { + "type": "Point", + "coordinates": + [ + 23.1, + 32.1 + ], + "crs": + { + "type": "name", + "properties": + { + "name": "EPSG:4326" + } + } + }, + "Numbers@odata.type": "#Collection(String)", + "Numbers": + [ + "111-111-1111" + ], + "Emails@odata.type": "#Collection(String)", + "Emails": + [ + "abc@abc.com" + ], + "City": "London", + "Birthday@odata.type": "#DateTimeOffset", + "Birthday": "1957-04-03T00:00:00Z", + "TimeBetweenLastTwoOrders@odata.type": "#Duration", + "TimeBetweenLastTwoOrders": "PT0.0000001S", + "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Parent/$ref", + "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Parent", + "Orders@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Orders/$ref", + "Orders@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Orders", + "Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Company/$ref", + "Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Company", + "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress": + { + "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress", + "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress" + }, + "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress": + { + "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress", + "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress" + } +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/Customers/1/entity.xml b/fit/src/main/resources/v4/Customers/1/entity.xml new file mode 100644 index 000000000..d3e25a69a --- /dev/null +++ b/fit/src/main/resources/v4/Customers/1/entity.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. + +--> +<entry xml:base="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Customers/$entity"> + <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Company" /> + <title /> + <updated>2014-03-24T17:03:20Z</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> \ No newline at end of file diff --git a/fit/src/main/resources/v4/Customers/1/links/Company.full.json b/fit/src/main/resources/v4/Customers/1/links/Company.full.json new file mode 100644 index 000000000..3d307c84e --- /dev/null +++ b/fit/src/main/resources/v4/Customers/1/links/Company.full.json @@ -0,0 +1,4 @@ +{ + "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Customer/$links/Info", + "url": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company" +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/Customers/1/links/Company.xml b/fit/src/main/resources/v4/Customers/1/links/Company.xml new file mode 100644 index 000000000..1bf957591 --- /dev/null +++ b/fit/src/main/resources/v4/Customers/1/links/Company.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. + +--> +<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company</uri> \ No newline at end of file diff --git a/fit/src/main/resources/v4/Customers/1/links/Orders.full.json b/fit/src/main/resources/v4/Customers/1/links/Orders.full.json new file mode 100644 index 000000000..d684d9a51 --- /dev/null +++ b/fit/src/main/resources/v4/Customers/1/links/Orders.full.json @@ -0,0 +1,10 @@ +{ + "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#Customer/$links/Orders", + "value": + [ + { + "url": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Orders(8)" + } + ], + "odata.nextLink": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Customers(1)/$links/Orders?$skiptoken=2" +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/Customers/1/links/Orders.xml b/fit/src/main/resources/v4/Customers/1/links/Orders.xml new file mode 100644 index 000000000..52bd53def --- /dev/null +++ b/fit/src/main/resources/v4/Customers/1/links/Orders.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. + +--> +<links xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices"> + <uri>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Orders(8)</uri> + <next>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Customers(1)/$links/Orders?$skiptoken=2</next> +</links> \ No newline at end of file diff --git a/fit/src/main/resources/v4/Orders/8/entity.full.json b/fit/src/main/resources/v4/Orders/8/entity.full.json new file mode 100644 index 000000000..69199f2bc --- /dev/null +++ b/fit/src/main/resources/v4/Orders/8/entity.full.json @@ -0,0 +1,23 @@ +{ + "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders/$entity", + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Order", + "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)", + "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)", + "@odata.etag": "W/\"123456789001\"", + "OrderID": 8, + "OrderDate@odata.type": "#DateTimeOffset", + "OrderDate": "2011-03-04T16:03:57Z", + "ShelfLife@odata.type": "#Duration", + "ShelfLife": "PT0.0000001S", + "OrderShelfLifes@odata.type": "#Collection(Duration)", + "OrderShelfLifes": + [ + "PT0.0000001S" + ], + "LoggedInEmployee@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee/$ref", + "LoggedInEmployee@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee", + "CustomerForOrder@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder/$ref", + "CustomerForOrder@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder", + "OrderDetails@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails/$ref", + "OrderDetails@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails" +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/Orders/8/entity.xml b/fit/src/main/resources/v4/Orders/8/entity.xml new file mode 100644 index 000000000..8dec66dda --- /dev/null +++ b/fit/src/main/resources/v4/Orders/8/entity.xml @@ -0,0 +1,50 @@ +<?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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders/$entity" + m:etag="W/"123456789001""> + <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)</id> + <category term="#Microsoft.Test.OData.Services.ODataWCFService.Order" scheme="http://docs.oasis-open.org/odata/ns/scheme" /> + <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/LoggedInEmployee" type="application/atom+xml;type=entry" title="LoggedInEmployee" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/CustomerForOrder" type="application/atom+xml;type=entry" title="CustomerForOrder" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/OrderDetails" type="application/atom+xml;type=feed" title="OrderDetails" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails" /> + <title /> + <updated>2014-03-24T17:36:01Z</updated> + <author> + <name /> + </author> + <content type="application/xml"> + <m:properties> + <d:OrderID m:type="Int32">8</d:OrderID> + <d:OrderDate m:type="DateTimeOffset">2011-03-04T16:03:57Z</d:OrderDate> + <d:ShelfLife m:type="Duration">PT0.0000001S</d:ShelfLife> + <d:OrderShelfLifes m:type="#Collection(Duration)"> + <m:element>PT0.0000001S</m:element> + </d:OrderShelfLifes> + </m:properties> + </content> +</entry> \ No newline at end of file diff --git a/fit/src/main/resources/v4/Orders/8/etag.txt b/fit/src/main/resources/v4/Orders/8/etag.txt new file mode 100644 index 000000000..46cda3159 --- /dev/null +++ b/fit/src/main/resources/v4/Orders/8/etag.txt @@ -0,0 +1 @@ +W/"123456789001" \ No newline at end of file diff --git a/fit/src/main/resources/v4/Orders/8/links/.full.json b/fit/src/main/resources/v4/Orders/8/links/.full.json new file mode 100644 index 000000000..ae6a7fd70 --- /dev/null +++ b/fit/src/main/resources/v4/Orders/8/links/.full.json @@ -0,0 +1,4 @@ +{ + "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#Customer/$links/Info", + "url": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/CustomerInfo(11)" +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.full.json b/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.full.json new file mode 100644 index 000000000..3a57fd094 --- /dev/null +++ b/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.full.json @@ -0,0 +1,4 @@ +{ + "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders/$links/CustomerForOrder", + "url": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(1)" +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.xml b/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.xml new file mode 100644 index 000000000..f7e70fcba --- /dev/null +++ b/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.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. + +--> +<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(1)</uri> \ No newline at end of file diff --git a/fit/src/main/resources/v4/Orders/feed.full.json b/fit/src/main/resources/v4/Orders/feed.full.json new file mode 100644 index 000000000..1752c62f1 --- /dev/null +++ b/fit/src/main/resources/v4/Orders/feed.full.json @@ -0,0 +1,48 @@ +{ + "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders", + "value": + [ + { + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Order", + "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)", + "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)", + "OrderID": 7, + "OrderDate@odata.type": "#DateTimeOffset", + "OrderDate": "2011-05-29T14:21:12Z", + "ShelfLife@odata.type": "#Duration", + "ShelfLife": "PT0.0000001S", + "OrderShelfLifes@odata.type": "#Collection(Duration)", + "OrderShelfLifes": + [ + "PT0.0000001S" + ], + "LoggedInEmployee@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/LoggedInEmployee/$ref", + "LoggedInEmployee@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/LoggedInEmployee", + "CustomerForOrder@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/CustomerForOrder/$ref", + "CustomerForOrder@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/CustomerForOrder", + "OrderDetails@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/OrderDetails/$ref", + "OrderDetails@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/OrderDetails" + }, + { + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Order", + "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)", + "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)", + "OrderID": 8, + "OrderDate@odata.type": "#DateTimeOffset", + "OrderDate": "2011-03-04T16:03:57Z", + "ShelfLife@odata.type": "#Duration", + "ShelfLife": "PT0.0000001S", + "OrderShelfLifes@odata.type": "#Collection(Duration)", + "OrderShelfLifes": + [ + "PT0.0000001S" + ], + "LoggedInEmployee@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee/$ref", + "LoggedInEmployee@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee", + "CustomerForOrder@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder/$ref", + "CustomerForOrder@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder", + "OrderDetails@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails/$ref", + "OrderDetails@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails" + } + ] +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/Orders/feed.xml b/fit/src/main/resources/v4/Orders/feed.xml new file mode 100644 index 000000000..2a32d3172 --- /dev/null +++ b/fit/src/main/resources/v4/Orders/feed.xml @@ -0,0 +1,72 @@ +<?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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders"> + <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders</id> + <title /> + <updated>2014-03-24T17:17:25Z</updated> + <entry> + <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)</id> + <category term="#Microsoft.Test.OData.Services.ODataWCFService.Order" scheme="http://docs.oasis-open.org/odata/ns/scheme" /> + <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/LoggedInEmployee" type="application/atom+xml;type=entry" title="LoggedInEmployee" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/LoggedInEmployee" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/CustomerForOrder" type="application/atom+xml;type=entry" title="CustomerForOrder" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/CustomerForOrder" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/OrderDetails" type="application/atom+xml;type=feed" title="OrderDetails" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/OrderDetails" /> + <title /> + <updated>2014-03-24T17:17:25Z</updated> + <author> + <name /> + </author> + <content type="application/xml"> + <m:properties> + <d:OrderID m:type="Int32">7</d:OrderID> + <d:OrderDate m:type="DateTimeOffset">2011-05-29T14:21:12Z</d:OrderDate> + <d:ShelfLife m:type="Duration">PT0.0000001S</d:ShelfLife> + <d:OrderShelfLifes m:type="#Collection(Duration)"> + <m:element>PT0.0000001S</m:element> + </d:OrderShelfLifes> + </m:properties> + </content> + </entry> + <entry> + <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)</id> + <category term="#Microsoft.Test.OData.Services.ODataWCFService.Order" scheme="http://docs.oasis-open.org/odata/ns/scheme" /> + <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/LoggedInEmployee" type="application/atom+xml;type=entry" title="LoggedInEmployee" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/CustomerForOrder" type="application/atom+xml;type=entry" title="CustomerForOrder" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/OrderDetails" type="application/atom+xml;type=feed" title="OrderDetails" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails" /> + <title /> + <updated>2014-03-24T17:17:25Z</updated> + <author> + <name /> + </author> + <content type="application/xml"> + <m:properties> + <d:OrderID m:type="Int32">8</d:OrderID> + <d:OrderDate m:type="DateTimeOffset">2011-03-04T16:03:57Z</d:OrderDate> + <d:ShelfLife m:type="Duration">PT0.0000001S</d:ShelfLife> + <d:OrderShelfLifes m:type="#Collection(Duration)"> + <m:element>PT0.0000001S</m:element> + </d:OrderShelfLifes> + </m:properties> + </content> + </entry> +</feed> \ No newline at end of file diff --git a/fit/src/main/resources/v4/People/5/entity.full.json b/fit/src/main/resources/v4/People/5/entity.full.json new file mode 100644 index 000000000..35968810f --- /dev/null +++ b/fit/src/main/resources/v4/People/5/entity.full.json @@ -0,0 +1,51 @@ +{ + "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#People/$entity", + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Person", + "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)", + "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)", + "PersonID": 5, + "FirstName": "Peter", + "LastName": "Bee", + "MiddleName": null, + "HomeAddress": null, + "Home@odata.type": "#GeographyPoint", + "Home": + { + "type": "Point", + "coordinates": + [ + -261.8, + -16 + ], + "crs": + { + "type": "name", + "properties": + { + "name": "EPSG:4326" + } + } + }, + "Numbers@odata.type": "#Collection(String)", + "Numbers": + [ + "555-555-5555" + ], + "Emails@odata.type": "#Collection(String)", + "Emails": + [ + "def@test.msn" + ], + "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent/$ref", + "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent", + "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress": + { + "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress", + "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress" + }, + "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress": + { + "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress", + "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress" + } +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/People/5/entity.xml b/fit/src/main/resources/v4/People/5/entity.xml new file mode 100644 index 000000000..daebef80f --- /dev/null +++ b/fit/src/main/resources/v4/People/5/entity.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#People/$entity"> + <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)</id> + <category term="#Microsoft.Test.OData.Services.ODataWCFService.Person" scheme="http://docs.oasis-open.org/odata/ns/scheme" /> + <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent" /> + <title /> + <updated>2014-03-24T17:20:17Z</updated> + <author> + <name /> + </author> + <content type="application/xml"> + <m:properties> + <d:PersonID m:type="Int32">5</d:PersonID> + <d:FirstName>Peter</d:FirstName> + <d:LastName>Bee</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>-16 -261.8</gml:pos> + </gml:Point> + </d:Home> + <d:Numbers m:type="#Collection(String)"> + <m:element>555-555-5555</m:element> + </d:Numbers> + <d:Emails m:type="#Collection(String)"> + <m:element>def@test.msn</m:element> + </d:Emails> + <d:IsRegistered m:type="Boolean">true</d:IsRegistered> + <d:Height m:type="Decimal">179</d:Height> + <d:PDC m:type="Binary">fi653p3+MklA/LdoBlhWgnMTUUEo8tEgtbMXnF0a3CUNL9BZxXpSRiD9ebTnmNR0zWPjJVIDx4tdmCnq55XrJh+RW9aI/b34wAogK3kcORw=</d:PDC> + </m:properties> + </content> +</entry> \ No newline at end of file diff --git a/fit/src/main/resources/v4/ProductDetails/6 1/entity.full.json b/fit/src/main/resources/v4/ProductDetails/6 1/entity.full.json new file mode 100644 index 000000000..38e347f28 --- /dev/null +++ b/fit/src/main/resources/v4/ProductDetails/6 1/entity.full.json @@ -0,0 +1,19 @@ +{ + "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#ProductDetails/$entity", + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.ProductDetail", + "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)", + "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)", + "ProductID": 6, + "ProductDetailID": 1, + "ProductName": "Candy", + "Description": "sweet snack", + "RelatedProduct@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/RelatedProduct/$ref", + "RelatedProduct@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/RelatedProduct", + "Reviews@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/Reviews/$ref", + "Reviews@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/Reviews", + "#Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct": + { + "title": "Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct", + "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct" + } +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/ProductDetails/6 1/entity.xml b/fit/src/main/resources/v4/ProductDetails/6 1/entity.xml new file mode 100644 index 000000000..ae66ac858 --- /dev/null +++ b/fit/src/main/resources/v4/ProductDetails/6 1/entity.xml @@ -0,0 +1,41 @@ +<?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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#ProductDetails/$entity"> + <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)</id> + <category term="#Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" scheme="http://docs.oasis-open.org/odata/ns/scheme" /> + <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/RelatedProduct" type="application/atom+xml;type=entry" title="RelatedProduct" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/RelatedProduct" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/Reviews" type="application/atom+xml;type=feed" title="Reviews" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/Reviews" /> + <title /> + <updated>2014-03-24T17:23:51Z</updated> + <author> + <name /> + </author> + <content type="application/xml"> + <m:properties> + <d:ProductID m:type="Int32">6</d:ProductID> + <d:ProductDetailID m:type="Int32">1</d:ProductDetailID> + <d:ProductName>Candy</d:ProductName> + <d:Description>sweet snack</d:Description> + </m:properties> + </content> +</entry> \ No newline at end of file diff --git a/fit/src/main/resources/v4/badRequest.json b/fit/src/main/resources/v4/badRequest.json new file mode 100644 index 000000000..b6bc3ac9c --- /dev/null +++ b/fit/src/main/resources/v4/badRequest.json @@ -0,0 +1,17 @@ +{ + "odata.error": + { + "code": "", + "message": + { + "lang": "en-US", + "value": "Bad request." + }, + "innererror": + { + "message": "Bad request.", + "type": "Microsoft.Data.OData.BadRequest", + "stacktrace": " at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings...." + } + } +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/badRequest.xml b/fit/src/main/resources/v4/badRequest.xml new file mode 100644 index 000000000..febd2febc --- /dev/null +++ b/fit/src/main/resources/v4/badRequest.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:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> + <m:code /> + <m:message xml:lang="en-US">Bad request.</m:message> + <m:innererror> + <m:message>Bad request.</m:message> + <m:type>Microsoft.Data.OData.BadRequest</m:type> + <m:stacktrace> at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings...</m:stacktrace> + </m:innererror> +</m:error> \ No newline at end of file diff --git a/fit/src/main/resources/v4/northwind-metadata.xml b/fit/src/main/resources/v4/northwind-metadata.xml new file mode 100644 index 000000000..85f260fae --- /dev/null +++ b/fit/src/main/resources/v4/northwind-metadata.xml @@ -0,0 +1,91 @@ +<?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="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"> + <edmx:Reference Uri="http://localhost:${cargo.servlet.port}/StaticService/V40/NorthWindExt.svc"> + <edmx:Include Namespace="NorthwindModel"/> + </edmx:Reference> + <edmx:DataServices> + <Schema Namespace="ODataWebExperimental.Northwind.Model" xmlns="http://docs.oasis-open.org/odata/ns/edm"> + <EntityContainer Name="NorthwindEntities" p4:LazyLoadingEnabled="true" xmlns:p4="http://schemas.microsoft.com/ado/2009/02/edm/annotation"> + <EntitySet Name="Categories" EntityType="NorthwindModel.Category"> + <NavigationPropertyBinding Path="Products" Target="Products" /> + </EntitySet> + <EntitySet Name="CustomerDemographics" EntityType="NorthwindModel.CustomerDemographic"> + <NavigationPropertyBinding Path="Customers" Target="Customers" /> + </EntitySet> + <EntitySet Name="Customers" EntityType="NorthwindModel.Customer"> + <NavigationPropertyBinding Path="CustomerDemographics" Target="CustomerDemographics" /> + <NavigationPropertyBinding Path="Orders" Target="Orders" /> + </EntitySet> + <EntitySet Name="Employees" EntityType="NorthwindModel.Employee"> + <NavigationPropertyBinding Path="Employees1" Target="Employees" /> + <NavigationPropertyBinding Path="Employee1" Target="Employees" /> + <NavigationPropertyBinding Path="Orders" Target="Orders" /> + <NavigationPropertyBinding Path="Territories" Target="Territories" /> + </EntitySet> + <EntitySet Name="Order_Details" EntityType="NorthwindModel.Order_Detail"> + <NavigationPropertyBinding Path="Order" Target="Orders" /> + <NavigationPropertyBinding Path="Product" Target="Products" /> + </EntitySet> + <EntitySet Name="Orders" EntityType="NorthwindModel.Order"> + <NavigationPropertyBinding Path="Customer" Target="Customers" /> + <NavigationPropertyBinding Path="Employee" Target="Employees" /> + <NavigationPropertyBinding Path="Order_Details" Target="Order_Details" /> + <NavigationPropertyBinding Path="Shipper" Target="Shippers" /> + </EntitySet> + <EntitySet Name="Products" EntityType="NorthwindModel.Product"> + <NavigationPropertyBinding Path="Category" Target="Categories" /> + <NavigationPropertyBinding Path="Order_Details" Target="Order_Details" /> + <NavigationPropertyBinding Path="Supplier" Target="Suppliers" /> + </EntitySet> + <EntitySet Name="Regions" EntityType="NorthwindModel.Region"> + <NavigationPropertyBinding Path="Territories" Target="Territories" /> + </EntitySet> + <EntitySet Name="Shippers" EntityType="NorthwindModel.Shipper"> + <NavigationPropertyBinding Path="Orders" Target="Orders" /> + </EntitySet> + <EntitySet Name="Suppliers" EntityType="NorthwindModel.Supplier"> + <NavigationPropertyBinding Path="Products" Target="Products" /> + </EntitySet> + <EntitySet Name="Territories" EntityType="NorthwindModel.Territory"> + <NavigationPropertyBinding Path="Employees" Target="Employees" /> + <NavigationPropertyBinding Path="Region" Target="Regions" /> + </EntitySet> + <EntitySet Name="Alphabetical_list_of_products" EntityType="NorthwindModel.Alphabetical_list_of_product" /> + <EntitySet Name="Category_Sales_for_1997" EntityType="NorthwindModel.Category_Sales_for_1997" /> + <EntitySet Name="Current_Product_Lists" EntityType="NorthwindModel.Current_Product_List" /> + <EntitySet Name="Customer_and_Suppliers_by_Cities" EntityType="NorthwindModel.Customer_and_Suppliers_by_City" /> + <EntitySet Name="Invoices" EntityType="NorthwindModel.Invoice" /> + <EntitySet Name="Order_Details_Extendeds" EntityType="NorthwindModel.Order_Details_Extended" /> + <EntitySet Name="Order_Subtotals" EntityType="NorthwindModel.Order_Subtotal" /> + <EntitySet Name="Orders_Qries" EntityType="NorthwindModel.Orders_Qry" /> + <EntitySet Name="Product_Sales_for_1997" EntityType="NorthwindModel.Product_Sales_for_1997" /> + <EntitySet Name="Products_Above_Average_Prices" EntityType="NorthwindModel.Products_Above_Average_Price" /> + <EntitySet Name="Products_by_Categories" EntityType="NorthwindModel.Products_by_Category" /> + <EntitySet Name="Sales_by_Categories" EntityType="NorthwindModel.Sales_by_Category" /> + <EntitySet Name="Sales_Totals_by_Amounts" EntityType="NorthwindModel.Sales_Totals_by_Amount" /> + <EntitySet Name="Summary_of_Sales_by_Quarters" EntityType="NorthwindModel.Summary_of_Sales_by_Quarter" /> + <EntitySet Name="Summary_of_Sales_by_Years" EntityType="NorthwindModel.Summary_of_Sales_by_Year" /> + </EntityContainer> + </Schema> + </edmx:DataServices> +</edmx:Edmx> \ No newline at end of file diff --git a/fit/src/main/resources/v4/northwindExt-metadata.xml b/fit/src/main/resources/v4/northwindExt-metadata.xml new file mode 100644 index 000000000..fa1832b58 --- /dev/null +++ b/fit/src/main/resources/v4/northwindExt-metadata.xml @@ -0,0 +1,408 @@ +<?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="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"> + <edmx:DataServices> + <Schema Namespace="NorthwindModel" xmlns="http://docs.oasis-open.org/odata/ns/edm"> + <EntityType Name="Category"> + <Key> + <PropertyRef Name="CategoryID" /> + </Key> + <Property Name="CategoryID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" /> + <Property Name="Description" Type="Edm.String" MaxLength="max" /> + <Property Name="Picture" Type="Edm.Binary" MaxLength="max" /> + <NavigationProperty Name="Products" Type="Collection(NorthwindModel.Product)" Partner="Category" /> + </EntityType> + <EntityType Name="CustomerDemographic"> + <Key> + <PropertyRef Name="CustomerTypeID" /> + </Key> + <Property Name="CustomerTypeID" Type="Edm.String" Nullable="false" MaxLength="10" /> + <Property Name="CustomerDesc" Type="Edm.String" MaxLength="max" /> + <NavigationProperty Name="Customers" Type="Collection(NorthwindModel.Customer)" Partner="CustomerDemographics" /> + </EntityType> + <EntityType Name="Customer"> + <Key> + <PropertyRef Name="CustomerID" /> + </Key> + <Property Name="CustomerID" Type="Edm.String" Nullable="false" MaxLength="5" /> + <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="ContactName" Type="Edm.String" MaxLength="30" /> + <Property Name="ContactTitle" Type="Edm.String" MaxLength="30" /> + <Property Name="Address" Type="Edm.String" MaxLength="60" /> + <Property Name="City" Type="Edm.String" MaxLength="15" /> + <Property Name="Region" Type="Edm.String" MaxLength="15" /> + <Property Name="PostalCode" Type="Edm.String" MaxLength="10" /> + <Property Name="Country" Type="Edm.String" MaxLength="15" /> + <Property Name="Phone" Type="Edm.String" MaxLength="24" /> + <Property Name="Fax" Type="Edm.String" MaxLength="24" /> + <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Customer" /> + <NavigationProperty Name="CustomerDemographics" Type="Collection(NorthwindModel.CustomerDemographic)" Partner="Customers" /> + </EntityType> + <EntityType Name="Employee"> + <Key> + <PropertyRef Name="EmployeeID" /> + </Key> + <Property Name="EmployeeID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Name="LastName" Type="Edm.String" Nullable="false" MaxLength="20" /> + <Property Name="FirstName" Type="Edm.String" Nullable="false" MaxLength="10" /> + <Property Name="Title" Type="Edm.String" MaxLength="30" /> + <Property Name="TitleOfCourtesy" Type="Edm.String" MaxLength="25" /> + <Property Name="BirthDate" Type="Edm.DateTimeOffset" /> + <Property Name="HireDate" Type="Edm.DateTimeOffset" /> + <Property Name="Address" Type="Edm.String" MaxLength="60" /> + <Property Name="City" Type="Edm.String" MaxLength="15" /> + <Property Name="Region" Type="Edm.String" MaxLength="15" /> + <Property Name="PostalCode" Type="Edm.String" MaxLength="10" /> + <Property Name="Country" Type="Edm.String" MaxLength="15" /> + <Property Name="HomePhone" Type="Edm.String" MaxLength="24" /> + <Property Name="Extension" Type="Edm.String" MaxLength="4" /> + <Property Name="Photo" Type="Edm.Binary" MaxLength="max" /> + <Property Name="Notes" Type="Edm.String" MaxLength="max" /> + <Property Name="ReportsTo" Type="Edm.Int32" /> + <Property Name="PhotoPath" Type="Edm.String" MaxLength="255" /> + <NavigationProperty Name="Employees1" Type="Collection(NorthwindModel.Employee)" Partner="Employee1" /> + <NavigationProperty Name="Employee1" Type="NorthwindModel.Employee" Partner="Employees1"> + <ReferentialConstraint Property="ReportsTo" ReferencedProperty="EmployeeID" /> + </NavigationProperty> + <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Employee" /> + <NavigationProperty Name="Territories" Type="Collection(NorthwindModel.Territory)" Partner="Employees" /> + </EntityType> + <EntityType Name="Order_Detail"> + <Key> + <PropertyRef Name="OrderID" /> + <PropertyRef Name="ProductID" /> + </Key> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> + <Property Name="ProductID" Type="Edm.Int32" Nullable="false" /> + <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" /> + <Property Name="Quantity" Type="Edm.Int16" Nullable="false" /> + <Property Name="Discount" Type="Edm.Single" Nullable="false" /> + <NavigationProperty Name="Order" Type="NorthwindModel.Order" Nullable="false" Partner="Order_Details"> + <ReferentialConstraint Property="OrderID" ReferencedProperty="OrderID" /> + </NavigationProperty> + <NavigationProperty Name="Product" Type="NorthwindModel.Product" Nullable="false" Partner="Order_Details"> + <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" /> + </NavigationProperty> + </EntityType> + <EntityType Name="Order"> + <Key> + <PropertyRef Name="OrderID" /> + </Key> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Name="CustomerID" Type="Edm.String" MaxLength="5" /> + <Property Name="EmployeeID" Type="Edm.Int32" /> + <Property Name="OrderDate" Type="Edm.DateTimeOffset" /> + <Property Name="RequiredDate" Type="Edm.DateTimeOffset" /> + <Property Name="ShippedDate" Type="Edm.DateTimeOffset" /> + <Property Name="ShipVia" Type="Edm.Int32" /> + <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" /> + <Property Name="ShipName" Type="Edm.String" MaxLength="40" /> + <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" /> + <Property Name="ShipCity" Type="Edm.String" MaxLength="15" /> + <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" /> + <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" /> + <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" /> + <NavigationProperty Name="Customer" Type="NorthwindModel.Customer" Partner="Orders"> + <ReferentialConstraint Property="CustomerID" ReferencedProperty="CustomerID" /> + </NavigationProperty> + <NavigationProperty Name="Employee" Type="NorthwindModel.Employee" Partner="Orders"> + <ReferentialConstraint Property="EmployeeID" ReferencedProperty="EmployeeID" /> + </NavigationProperty> + <NavigationProperty Name="Order_Details" Type="Collection(NorthwindModel.Order_Detail)" Partner="Order" /> + <NavigationProperty Name="Shipper" Type="NorthwindModel.Shipper" Partner="Orders"> + <ReferentialConstraint Property="ShipVia" ReferencedProperty="ShipperID" /> + </NavigationProperty> + </EntityType> + <EntityType Name="Product"> + <Key> + <PropertyRef Name="ProductID" /> + </Key> + <Property Name="ProductID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="SupplierID" Type="Edm.Int32" /> + <Property Name="CategoryID" Type="Edm.Int32" /> + <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" /> + <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" /> + <Property Name="UnitsInStock" Type="Edm.Int16" /> + <Property Name="UnitsOnOrder" Type="Edm.Int16" /> + <Property Name="ReorderLevel" Type="Edm.Int16" /> + <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" /> + <NavigationProperty Name="Category" Type="NorthwindModel.Category" Partner="Products"> + <ReferentialConstraint Property="CategoryID" ReferencedProperty="CategoryID" /> + </NavigationProperty> + <NavigationProperty Name="Order_Details" Type="Collection(NorthwindModel.Order_Detail)" Partner="Product" /> + <NavigationProperty Name="Supplier" Type="NorthwindModel.Supplier" Partner="Products"> + <ReferentialConstraint Property="SupplierID" ReferencedProperty="SupplierID" /> + </NavigationProperty> + </EntityType> + <EntityType Name="Region"> + <Key> + <PropertyRef Name="RegionID" /> + </Key> + <Property Name="RegionID" Type="Edm.Int32" Nullable="false" /> + <Property Name="RegionDescription" Type="Edm.String" Nullable="false" MaxLength="50" /> + <NavigationProperty Name="Territories" Type="Collection(NorthwindModel.Territory)" Partner="Region" /> + </EntityType> + <EntityType Name="Shipper"> + <Key> + <PropertyRef Name="ShipperID" /> + </Key> + <Property Name="ShipperID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="Phone" Type="Edm.String" MaxLength="24" /> + <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Shipper" /> + </EntityType> + <EntityType Name="Supplier"> + <Key> + <PropertyRef Name="SupplierID" /> + </Key> + <Property Name="SupplierID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="ContactName" Type="Edm.String" MaxLength="30" /> + <Property Name="ContactTitle" Type="Edm.String" MaxLength="30" /> + <Property Name="Address" Type="Edm.String" MaxLength="60" /> + <Property Name="City" Type="Edm.String" MaxLength="15" /> + <Property Name="Region" Type="Edm.String" MaxLength="15" /> + <Property Name="PostalCode" Type="Edm.String" MaxLength="10" /> + <Property Name="Country" Type="Edm.String" MaxLength="15" /> + <Property Name="Phone" Type="Edm.String" MaxLength="24" /> + <Property Name="Fax" Type="Edm.String" MaxLength="24" /> + <Property Name="HomePage" Type="Edm.String" MaxLength="max" /> + <NavigationProperty Name="Products" Type="Collection(NorthwindModel.Product)" Partner="Supplier" /> + </EntityType> + <EntityType Name="Territory"> + <Key> + <PropertyRef Name="TerritoryID" /> + </Key> + <Property Name="TerritoryID" Type="Edm.String" Nullable="false" MaxLength="20" /> + <Property Name="TerritoryDescription" Type="Edm.String" Nullable="false" MaxLength="50" /> + <Property Name="RegionID" Type="Edm.Int32" Nullable="false" /> + <NavigationProperty Name="Region" Type="NorthwindModel.Region" Nullable="false" Partner="Territories"> + <ReferentialConstraint Property="RegionID" ReferencedProperty="RegionID" /> + </NavigationProperty> + <NavigationProperty Name="Employees" Type="Collection(NorthwindModel.Employee)" Partner="Territories" /> + </EntityType> + <EntityType Name="Alphabetical_list_of_product"> + <Key> + <PropertyRef Name="CategoryName" /> + <PropertyRef Name="Discontinued" /> + <PropertyRef Name="ProductID" /> + <PropertyRef Name="ProductName" /> + </Key> + <Property Name="ProductID" Type="Edm.Int32" Nullable="false" /> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="SupplierID" Type="Edm.Int32" /> + <Property Name="CategoryID" Type="Edm.Int32" /> + <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" /> + <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" /> + <Property Name="UnitsInStock" Type="Edm.Int16" /> + <Property Name="UnitsOnOrder" Type="Edm.Int16" /> + <Property Name="ReorderLevel" Type="Edm.Int16" /> + <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" /> + <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" /> + </EntityType> + <EntityType Name="Category_Sales_for_1997"> + <Key> + <PropertyRef Name="CategoryName" /> + </Key> + <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" /> + <Property Name="CategorySales" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <EntityType Name="Current_Product_List"> + <Key> + <PropertyRef Name="ProductID" /> + <PropertyRef Name="ProductName" /> + </Key> + <Property Name="ProductID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + </EntityType> + <EntityType Name="Customer_and_Suppliers_by_City"> + <Key> + <PropertyRef Name="CompanyName" /> + <PropertyRef Name="Relationship" /> + </Key> + <Property Name="City" Type="Edm.String" MaxLength="15" /> + <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="ContactName" Type="Edm.String" MaxLength="30" /> + <Property Name="Relationship" Type="Edm.String" Nullable="false" MaxLength="9" Unicode="false" /> + </EntityType> + <EntityType Name="Invoice"> + <Key> + <PropertyRef Name="CustomerName" /> + <PropertyRef Name="Discount" /> + <PropertyRef Name="OrderID" /> + <PropertyRef Name="ProductID" /> + <PropertyRef Name="ProductName" /> + <PropertyRef Name="Quantity" /> + <PropertyRef Name="Salesperson" /> + <PropertyRef Name="ShipperName" /> + <PropertyRef Name="UnitPrice" /> + </Key> + <Property Name="ShipName" Type="Edm.String" MaxLength="40" /> + <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" /> + <Property Name="ShipCity" Type="Edm.String" MaxLength="15" /> + <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" /> + <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" /> + <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" /> + <Property Name="CustomerID" Type="Edm.String" MaxLength="5" /> + <Property Name="CustomerName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="Address" Type="Edm.String" MaxLength="60" /> + <Property Name="City" Type="Edm.String" MaxLength="15" /> + <Property Name="Region" Type="Edm.String" MaxLength="15" /> + <Property Name="PostalCode" Type="Edm.String" MaxLength="10" /> + <Property Name="Country" Type="Edm.String" MaxLength="15" /> + <Property Name="Salesperson" Type="Edm.String" Nullable="false" MaxLength="31" /> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> + <Property Name="OrderDate" Type="Edm.DateTimeOffset" /> + <Property Name="RequiredDate" Type="Edm.DateTimeOffset" /> + <Property Name="ShippedDate" Type="Edm.DateTimeOffset" /> + <Property Name="ShipperName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="ProductID" Type="Edm.Int32" Nullable="false" /> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" /> + <Property Name="Quantity" Type="Edm.Int16" Nullable="false" /> + <Property Name="Discount" Type="Edm.Single" Nullable="false" /> + <Property Name="ExtendedPrice" Type="Edm.Decimal" Precision="19" Scale="4" /> + <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <EntityType Name="Order_Details_Extended"> + <Key> + <PropertyRef Name="Discount" /> + <PropertyRef Name="OrderID" /> + <PropertyRef Name="ProductID" /> + <PropertyRef Name="ProductName" /> + <PropertyRef Name="Quantity" /> + <PropertyRef Name="UnitPrice" /> + </Key> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> + <Property Name="ProductID" Type="Edm.Int32" Nullable="false" /> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" /> + <Property Name="Quantity" Type="Edm.Int16" Nullable="false" /> + <Property Name="Discount" Type="Edm.Single" Nullable="false" /> + <Property Name="ExtendedPrice" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <EntityType Name="Order_Subtotal"> + <Key> + <PropertyRef Name="OrderID" /> + </Key> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> + <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <EntityType Name="Orders_Qry"> + <Key> + <PropertyRef Name="CompanyName" /> + <PropertyRef Name="OrderID" /> + </Key> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> + <Property Name="CustomerID" Type="Edm.String" MaxLength="5" /> + <Property Name="EmployeeID" Type="Edm.Int32" /> + <Property Name="OrderDate" Type="Edm.DateTimeOffset" /> + <Property Name="RequiredDate" Type="Edm.DateTimeOffset" /> + <Property Name="ShippedDate" Type="Edm.DateTimeOffset" /> + <Property Name="ShipVia" Type="Edm.Int32" /> + <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" /> + <Property Name="ShipName" Type="Edm.String" MaxLength="40" /> + <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" /> + <Property Name="ShipCity" Type="Edm.String" MaxLength="15" /> + <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" /> + <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" /> + <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" /> + <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="Address" Type="Edm.String" MaxLength="60" /> + <Property Name="City" Type="Edm.String" MaxLength="15" /> + <Property Name="Region" Type="Edm.String" MaxLength="15" /> + <Property Name="PostalCode" Type="Edm.String" MaxLength="10" /> + <Property Name="Country" Type="Edm.String" MaxLength="15" /> + </EntityType> + <EntityType Name="Product_Sales_for_1997"> + <Key> + <PropertyRef Name="CategoryName" /> + <PropertyRef Name="ProductName" /> + </Key> + <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" /> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="ProductSales" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <EntityType Name="Products_Above_Average_Price"> + <Key> + <PropertyRef Name="ProductName" /> + </Key> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <EntityType Name="Products_by_Category"> + <Key> + <PropertyRef Name="CategoryName" /> + <PropertyRef Name="Discontinued" /> + <PropertyRef Name="ProductName" /> + </Key> + <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" /> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" /> + <Property Name="UnitsInStock" Type="Edm.Int16" /> + <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" /> + </EntityType> + <EntityType Name="Sales_by_Category"> + <Key> + <PropertyRef Name="CategoryID" /> + <PropertyRef Name="CategoryName" /> + <PropertyRef Name="ProductName" /> + </Key> + <Property Name="CategoryID" Type="Edm.Int32" Nullable="false" /> + <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" /> + <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="ProductSales" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <EntityType Name="Sales_Totals_by_Amount"> + <Key> + <PropertyRef Name="CompanyName" /> + <PropertyRef Name="OrderID" /> + </Key> + <Property Name="SaleAmount" Type="Edm.Decimal" Precision="19" Scale="4" /> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> + <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" /> + <Property Name="ShippedDate" Type="Edm.DateTimeOffset" /> + </EntityType> + <EntityType Name="Summary_of_Sales_by_Quarter"> + <Key> + <PropertyRef Name="OrderID" /> + </Key> + <Property Name="ShippedDate" Type="Edm.DateTimeOffset" /> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> + <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <EntityType Name="Summary_of_Sales_by_Year"> + <Key> + <PropertyRef Name="OrderID" /> + </Key> + <Property Name="ShippedDate" Type="Edm.DateTimeOffset" /> + <Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> + <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" /> + </EntityType> + <Annotations Target="ODataWebExperimental.Northwind.Model.NorthwindEntities"> + <Annotation Term="Com.Microsoft.OData.Service.Conventions.V1.UrlConventions" String="KeyAsSegment" /> + </Annotations> + </Schema> + </edmx:DataServices> +</edmx:Edmx> \ No newline at end of file diff --git a/fit/src/main/resources/v4/notFound.json b/fit/src/main/resources/v4/notFound.json new file mode 100644 index 000000000..fba2ac481 --- /dev/null +++ b/fit/src/main/resources/v4/notFound.json @@ -0,0 +1,11 @@ +{ + "odata.error": + { + "code": "", + "message": + { + "lang": "en-US", + "value": "Resource not found for the segment 'Customer'." + } + } +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/notFound.xml b/fit/src/main/resources/v4/notFound.xml new file mode 100644 index 000000000..189d9adeb --- /dev/null +++ b/fit/src/main/resources/v4/notFound.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. + +--> +<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> + <m:code /> + <m:message xml:lang="en-US">Resource not found for the segment 'Customer'.</m:message> +</m:error> \ No newline at end of file diff --git a/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json b/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json new file mode 100644 index 000000000..e23e70c9c --- /dev/null +++ b/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json @@ -0,0 +1,4 @@ +{ + "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#$ref", + "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)" +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml b/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml new file mode 100644 index 000000000..6d847fcd9 --- /dev/null +++ b/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#$ref" id="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" /> \ No newline at end of file diff --git a/fit/src/main/resources/v4/services.full.json b/fit/src/main/resources/v4/services.full.json new file mode 100644 index 000000000..d76933267 --- /dev/null +++ b/fit/src/main/resources/v4/services.full.json @@ -0,0 +1,126 @@ +{ + "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata", + "value": + [ + { + "name": "People", + "kind": "EntitySet", + "url": "People" + }, + { + "name": "Customers", + "kind": "EntitySet", + "url": "Customers" + }, + { + "name": "Employees", + "kind": "EntitySet", + "url": "Employees" + }, + { + "name": "Products", + "kind": "EntitySet", + "url": "Products" + }, + { + "name": "ProductDetails", + "kind": "EntitySet", + "url": "ProductDetails" + }, + { + "name": "ProductReviews", + "kind": "EntitySet", + "url": "ProductReviews" + }, + { + "name": "Orders", + "kind": "EntitySet", + "url": "Orders" + }, + { + "name": "OrderDetails", + "kind": "EntitySet", + "url": "OrderDetails" + }, + { + "name": "Departments", + "kind": "EntitySet", + "url": "Departments" + }, + { + "name": "Accounts", + "kind": "EntitySet", + "url": "Accounts" + }, + { + "name": "StoredPIs", + "kind": "EntitySet", + "url": "StoredPIs" + }, + { + "name": "SubscriptionTemplates", + "kind": "EntitySet", + "url": "SubscriptionTemplates" + }, + { + "name": "Boss", + "kind": "Singleton", + "url": "Boss" + }, + { + "name": "VipCustomer", + "kind": "Singleton", + "url": "VipCustomer" + }, + { + "name": "Company", + "kind": "Singleton", + "url": "Company" + }, + { + "name": "PublicCompany", + "kind": "Singleton", + "url": "PublicCompany" + }, + { + "name": "LabourUnion", + "kind": "Singleton", + "url": "LabourUnion" + }, + { + "name": "DefaultStoredPI", + "kind": "Singleton", + "url": "DefaultStoredPI" + }, + { + "name": "GetDefaultColor", + "kind": "FunctionImport", + "url": "GetDefaultColor" + }, + { + "name": "GetPerson", + "kind": "FunctionImport", + "url": "GetPerson" + }, + { + "name": "GetPerson2", + "kind": "FunctionImport", + "url": "GetPerson2" + }, + { + "name": "GetAllProducts", + "kind": "FunctionImport", + "url": "GetAllProducts" + }, + { + "name": "GetBossEmails", + "kind": "FunctionImport", + "url": "GetBossEmails" + }, + { + "name": "GetProductsByAccessLevel", + "kind": "FunctionImport", + "url": "GetProductsByAccessLevel" + } + ] +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/services.xml b/fit/src/main/resources/v4/services.xml new file mode 100644 index 000000000..5ae733bff --- /dev/null +++ b/fit/src/main/resources/v4/services.xml @@ -0,0 +1,102 @@ +<?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. + +--> +<service xml:base="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/" + xmlns="http://www.w3.org/2007/app" + xmlns:atom="http://www.w3.org/2005/Atom" + xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" + m:context="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata"> + <workspace> + <atom:title type="text">InMemoryEntities</atom:title> + <collection href="People"> + <atom:title type="text">People</atom:title> + </collection> + <collection href="Customers"> + <atom:title type="text">Customers</atom:title> + </collection> + <collection href="Employees"> + <atom:title type="text">Employees</atom:title> + </collection> + <collection href="Products"> + <atom:title type="text">Products</atom:title> + </collection> + <collection href="ProductDetails"> + <atom:title type="text">ProductDetails</atom:title> + </collection> + <collection href="ProductReviews"> + <atom:title type="text">ProductReviews</atom:title> + </collection> + <collection href="Orders"> + <atom:title type="text">Orders</atom:title> + </collection> + <collection href="OrderDetails"> + <atom:title type="text">OrderDetails</atom:title> + </collection> + <collection href="Departments"> + <atom:title type="text">Departments</atom:title> + </collection> + <collection href="Accounts"> + <atom:title type="text">Accounts</atom:title> + </collection> + <collection href="StoredPIs"> + <atom:title type="text">StoredPIs</atom:title> + </collection> + <collection href="SubscriptionTemplates"> + <atom:title type="text">SubscriptionTemplates</atom:title> + </collection> + <m:singleton href="Boss"> + <atom:title type="text">Boss</atom:title> + </m:singleton> + <m:singleton href="VipCustomer"> + <atom:title type="text">VipCustomer</atom:title> + </m:singleton> + <m:singleton href="Company"> + <atom:title type="text">Company</atom:title> + </m:singleton> + <m:singleton href="PublicCompany"> + <atom:title type="text">PublicCompany</atom:title> + </m:singleton> + <m:singleton href="LabourUnion"> + <atom:title type="text">LabourUnion</atom:title> + </m:singleton> + <m:singleton href="DefaultStoredPI"> + <atom:title type="text">DefaultStoredPI</atom:title> + </m:singleton> + <m:function-import href="GetDefaultColor"> + <atom:title type="text">GetDefaultColor</atom:title> + </m:function-import> + <m:function-import href="GetPerson"> + <atom:title type="text">GetPerson</atom:title> + </m:function-import> + <m:function-import href="GetPerson2"> + <atom:title type="text">GetPerson2</atom:title> + </m:function-import> + <m:function-import href="GetAllProducts"> + <atom:title type="text">GetAllProducts</atom:title> + </m:function-import> + <m:function-import href="GetBossEmails"> + <atom:title type="text">GetBossEmails</atom:title> + </m:function-import> + <m:function-import href="GetProductsByAccessLevel"> + <atom:title type="text">GetProductsByAccessLevel</atom:title> + </m:function-import> + </workspace> +</service> \ No newline at end of file diff --git a/fit/src/main/resources/v4/unsupportedMediaType.json b/fit/src/main/resources/v4/unsupportedMediaType.json new file mode 100644 index 000000000..4dc5a1f0f --- /dev/null +++ b/fit/src/main/resources/v4/unsupportedMediaType.json @@ -0,0 +1,17 @@ +{ + "odata.error": + { + "code": "", + "message": + { + "lang": "en-US", + "value": "Unsupported media type requested." + }, + "innererror": + { + "message": "Unsupported media type requested.", + "type": "Microsoft.Data.OData.ODataContentTypeException", + "stacktrace": " at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings(ODataMessageWriterSettings settings, ODataPayloadKind payloadKind, MediaTypeResolver mediaTypeResolver, MediaType& mediaType, Encoding& encoding)\n at Microsoft.Data.OData.ODataMessageWriter.EnsureODataFormatAndContentType()\n at Microsoft.Data.OData.ODataMessageWriter.SetHeaders(ODataPayloadKind payloadKind)\n at Microsoft.Data.OData.ODataUtils.SetHeadersForPayload(ODataMessageWriter messageWriter, ODataPayloadKind payloadKind)\n at System.Data.Services.ResponseContentTypeNegotiator.DetermineResponseFormat(ODataPayloadKind payloadKind, String acceptableMediaTypes, String acceptableCharSets)" + } + } +} \ No newline at end of file diff --git a/fit/src/main/resources/v4/unsupportedMediaType.xml b/fit/src/main/resources/v4/unsupportedMediaType.xml new file mode 100644 index 000000000..c157fb186 --- /dev/null +++ b/fit/src/main/resources/v4/unsupportedMediaType.xml @@ -0,0 +1,34 @@ +<?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:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> + <m:code /> + <m:message xml:lang="en-US">Unsupported media type requested.</m:message> + <m:innererror> + <m:message>A supported MIME type could not be found that matches the acceptable MIME types for the request. The supported type(s) 'application/atom+xml;type=feed, application/atom+xml, application/json;odata=minimalmetadata;streaming=true, application/json;odata=minimalmetadata;streaming=false, application/json;odata=minimalmetadata, application/json;odata=fullmetadata;streaming=true, application/json;odata=fullmetadata;streaming=false, application/json;odata=fullmetadata, application/json;odata=nometadata;streaming=true, application/json;odata=nometadata;streaming=false, application/json;odata=nometadata, application/json;streaming=true, application/json;streaming=false, application/json;odata=verbose, application/json' do not match any of the acceptable MIME types 'application/xml'.</m:message> + <m:type>Microsoft.Data.OData.ODataContentTypeException</m:type> + <m:stacktrace> at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings(ODataMessageWriterSettings settings, ODataPayloadKind payloadKind, MediaTypeResolver mediaTypeResolver, MediaType& mediaType, Encoding& encoding) + at Microsoft.Data.OData.ODataMessageWriter.EnsureODataFormatAndContentType() + at Microsoft.Data.OData.ODataMessageWriter.SetHeaders(ODataPayloadKind payloadKind) + at Microsoft.Data.OData.ODataUtils.SetHeadersForPayload(ODataMessageWriter messageWriter, ODataPayloadKind payloadKind) + at System.Data.Services.ResponseContentTypeNegotiator.DetermineResponseFormat(ODataPayloadKind payloadKind, String acceptableMediaTypes, String acceptableCharSets)</m:stacktrace> + </m:innererror> +</m:error> \ No newline at end of file diff --git a/fit/src/main/webapp/WEB-INF/applicationContext.xml b/fit/src/main/webapp/WEB-INF/applicationContext.xml index f351ba636..18b555d86 100644 --- a/fit/src/main/webapp/WEB-INF/applicationContext.xml +++ b/fit/src/main/webapp/WEB-INF/applicationContext.xml @@ -39,8 +39,10 @@ <jaxrs:server id="services" address="/"> <jaxrs:serviceBeans> - <bean class="org.apache.olingo.fit.V4Services"/> <bean class="org.apache.olingo.fit.V3Services"/> + <bean class="org.apache.olingo.fit.V4Services"/> + <bean class="org.apache.olingo.fit.V4NorthWind"/> + <bean class="org.apache.olingo.fit.V4NorthWindExt"/> </jaxrs:serviceBeans> <jaxrs:providers> <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/> 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 e863d0de1..ed0910a4a 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,9 +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.ODataGeospatialValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +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; @@ -48,10 +46,6 @@ public interface CommonODataClient { CommonFilterFactory getFilterFactory(); - ODataPrimitiveValue.Builder getPrimitiveValueBuilder(); - - ODataGeospatialValue.Builder getGeospatialValueBuilder(); - ODataSerializer getSerializer(); ClientODataDeserializer getDeserializer(); @@ -62,7 +56,7 @@ public interface CommonODataClient { CommonODataBinder getBinder(); - ODataObjectFactory getObjectFactory(); + CommonODataObjectFactory getObjectFactory(); CommonRetrieveRequestFactory getRetrieveRequestFactory(); 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 85ae888ee..6dc2f074d 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); - } } /** diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java index b68cf3db8..67b3043f7 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java @@ -18,6 +18,11 @@ */ package org.apache.olingo.client.api.communication.header; +import java.util.Arrays; +import java.util.List; +import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; + /** * Major OData request/response header names. */ @@ -26,7 +31,17 @@ public enum HeaderName { /** * The OData protocol uses the Accept request-header field, as specified in [RFC2616]. */ - accept("Accept"), + accept("Accept", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), + /** + * As specified in [RFC2616], the client MAY specify the set of accepted character sets with the Accept-Charset + * header. + */ + acceptCharset("Accept-Charset", Arrays.asList(ODataServiceVersion.V40)), + /** + * As specified in [RFC2616], the client MAY specify the set of accepted natural languages with the Accept-Language + * header. + */ + acceptLanguage("Accept-Language", Arrays.asList(ODataServiceVersion.V40)), /** * The Content-Type header is used as specified in [RFC2616]. * <br/> @@ -44,76 +59,129 @@ public enum HeaderName { * <li>multipart/mixed</li> * </ul> */ - contentType("Content-Type"), + contentType("Content-Type", Arrays.asList(ODataServiceVersion.V30)), /** * This header is a custom HTTP header defined for protocol versioning purposes. This header MAY be present on any * request or response message. */ - dataServiceVersion("DataServiceVersion"), + dataServiceVersion("DataServiceVersion", Arrays.asList(ODataServiceVersion.V30)), + /** + * This header is a custom HTTP header defined for protocol versioning purposes. This header MAY be present on any + * request or response message. + */ + odataVersion("OData-Version", Arrays.asList(ODataServiceVersion.V40)), + /** + * A response to a create operation that returns 204 No Content MUST include an OData-EntityId response header. The + * value of the header is the entity-id of the entity that was acted on by the request. The syntax of the + * OData-EntityId preference is specified in [OData-ABNF]. + */ + odataEntityId("OData-EntityId", Arrays.asList(ODataServiceVersion.V40)), /** * An ETag (entity tag) is an HTTP response header returned by an HTTP/1.1 compliant web server used to determine * change in content of a resource at a given URL. The value of the header is an opaque string representing the state * of the resource at the time the response was generated. */ - etag("ETag"), + etag("ETag", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), /** * The If-Match request-header field is used with a method to make it conditional. As specified in [RFC2616], "the * purpose of this feature is to allow efficient updates of cached information with a minimum amount of transaction * overhead. It is also used, on updating requests, to prevent inadvertent modification of the wrong version of a * resource". */ - ifMatch("If-Match"), + ifMatch("If-Match", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), /** * The If-None-Match request header is used with a method to make it conditional. As specified in [RFC2616], "The * purpose of this feature is to allow efficient updates of cached information with a minimum amount of transaction * overhead. It is also used to prevent a method (for example, PUT) from inadvertently modifying an existing resource * when the client believes that the resource does not exist." */ - ifNoneMatch("If-None-Match"), + ifNoneMatch("If-None-Match", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), + /** + * Clients SHOULD specify an OData-MaxVersion request header. + * <br /> + * If specified the service MUST generate a response with an OData-Version less than or equal to the specified + * OData-MaxVersion. + * <br /> + * If OData-MaxVersion is not specified, then the service SHOULD interpret the request as having an OData-MaxVersion + * equal to the maximum version supported by the service. + */ + odataMaxVersion("OData-MaxVersion", Arrays.asList(ODataServiceVersion.V40)), /** * This header is a custom HTTP request only header defined for protocol versioning purposes. This header MAY be * present on any request message from client to server. */ - maxDataServiceVersion("MaxDataServiceVersion"), + maxDataServiceVersion("MaxDataServiceVersion", Arrays.asList(ODataServiceVersion.V30)), /** * This header is a custom HTTP request only header defined for protocol versioning purposes. This header MAY be * present on any request message from client to server. */ - minDataServiceVersion("MinDataServiceVersion"), + minDataServiceVersion("MinDataServiceVersion", Arrays.asList(ODataServiceVersion.V30)), + /** + * The OData-Isolation header specifies the isolation of the current request from external changes. The only supported + * value for this header is snapshot. + * <br /> + * If the service doesn’t support OData-Isolation:snapshot and this header was specified on the request, the service + * MUST NOT process the request and MUST respond with 412 Precondition Failed. + * <br /> + * Snapshot isolation guarantees that all data returned for a request, including multiple requests within a batch or + * results retrieved across multiple pages, will be consistent as of a single point in time. Only data modifications + * made within the request (for example, by a data modification request within the same batch) are visible. The effect + * is as if the request generates a "snapshot" of the committed data as it existed at the start of the request. + * <br /> + * The OData-Isolation header may be specified on a single or batch request. If it is specified on a batch then the + * value is applied to all statements within the batch. + * <br /> + * Next links returned within a snapshot return results within the same snapshot as the initial request; the client is + * not required to repeat the header on each individual page request. + * <br /> + * The OData-Isolation header has no effect on links other than the next link. Navigation links, read links, and edit + * links return the current version of the data. + * <br /> + * A service returns 410 Gone or 404 Not Found if a consumer tries to follow a next link referring to a snapshot that + * is no longer available. + * <br /> + * The syntax of the OData-Isolation header is specified in [OData-ABNF]. + * <br /> + * A service MAY specify the support for OData-Isolation:snapshot using an annotation with term + * Capabilities.IsolationSupport, see [OData-VocCap]. + */ + odataIsolation("OData-Isolation", Arrays.asList(ODataServiceVersion.V40)), /** * A Prefer header is included in a request to state the client’s preferred, but not required, server behavior (that * is, a hint to the server). The Prefer header MAY be included on any request type (within a standalone or batch * request), and a server MAY honor the header for HTTP POST, PUT, PATCH, and MERGE requests. A Prefer header with a * value of “return-content” MUST NOT be specified on a DELETE request, a batch request as a whole, or a PUT request * to update a named stream. + * + * @see ODataPreferenceNames. */ - prefer("Prefer"), + prefer("Prefer", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), /** * When a Prefer header value is successfully honored by the server, it MAY include a Preference-Applied response * header that states which preference values were honored by the server. */ - preferenceApplied("Preference-Applied"), + preferenceApplied("Preference-Applied", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), /** * The DataServiceId response header is returned by the server when the response payload for an HTTP PUT, POST, PATCH, * or MERGE request is empty. The value of the header is the identifier of the entity that was acted on by the PUT, * POST, PATCH, or MERGE request. The identifier, in this case, is the same identifier that would have been returned * in the response payload (for example, as the value of the atom:id element for Atom responses) */ - dataServiceId("DataServiceId"), + dataServiceId("DataServiceId", Arrays.asList(ODataServiceVersion.V30)), /** * Location header is used to specify the URL of an entity modified through a Data Modification request, or the * request URL to check on the status of an asynchronous operation as described in * <code>202 Accepted</code>. */ - location("Location"), + location("Location", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), /** * A service must include a * <code>Retry-After</code> header in a * <code>202 Accepted</code>. */ - retryAfter("Retry-After"), - dataServiceUrlConventions("DataServiceUrlConventions"), - slug("Slug"), + retryAfter("Retry-After", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), + dataServiceUrlConventions("DataServiceUrlConventions", Arrays.asList(ODataServiceVersion.V30)), + slug("Slug", Arrays.asList(ODataServiceVersion.V30)), /** * This header is a custom HTTP request header. * <br/> @@ -132,12 +200,21 @@ public enum HeaderName { * <br/> * This header is only valid when on POST requests. */ - xHttpMethod("X-HTTP-METHOD"); + xHttpMethod("X-HTTP-METHOD", Arrays.asList(ODataServiceVersion.V30)); private final String headerName; - private HeaderName(final String headerName) { + private final List<ODataServiceVersion> supportedVersions; + + private HeaderName(final String headerName, final List<ODataServiceVersion> supportedVersions) { this.headerName = headerName; + this.supportedVersions = supportedVersions; + } + + final void isSupportedBy(final ODataServiceVersion serviceVersion) { + if (!supportedVersions.contains(serviceVersion)) { + throw new ODataRuntimeException("Unsupported header " + this.toString()); + } } @Override diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataPreferences.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataPreferences.java new file mode 100644 index 000000000..6afa950d2 --- /dev/null +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataPreferences.java @@ -0,0 +1,424 @@ +/* + * 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.api.communication.header; + +import java.util.Arrays; +import java.util.List; +import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; + +/** + * Values of the Prefer header. + */ +public class ODataPreferences { + + final ODataServiceVersion serviceVersion; + + public ODataPreferences(final ODataServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + } + + /** + * <code>Prefer</code> header, return content. + * + * @see HeaderName#prefer + */ + public String returnContent() { + return PreferenceNames.returnContent.isSupportedBy(serviceVersion).toString(); + } + + /** + * <code>Prefer</code> header, return no content. + * + * @see HeaderName#prefer + */ + public String returnNoContent() { + return PreferenceNames.returnNoContent.isSupportedBy(serviceVersion).toString(); + } + + /** + * @see HeaderName#dataServiceUrlConventions + */ + public String keyAsSegment() { + return PreferenceNames.keyAsSegment.isSupportedBy(serviceVersion).toString(); + } + + /** + * The odata.allow-entityreferences preference indicates that the service is allowed to return entity references in + * place of entities that have previously been returned, with at least the properties requested, in the same response + * (for example, when serializing the expanded results of many-to-many relationships). The service MUST NOT return + * entity references in place of requested entities if odata.allow-entityreferences has not been specified in the + * request, unless explicitly defined by other rules in this document. The syntax of the odata.allow-entityreferences + * preference is specified in [OData-ABNF]. + * <br /> + * In the case the service applies the odata.allow-entityreferences preference it MUST include a Preference-Applied + * response header containing the odata.allow-entityreferences preference to indicate that entity references MAY be + * returned in place of entities that have previously been returned. + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String allowEntityReferences() { + return PreferenceNames.allowEntityReferences.isSupportedBy(serviceVersion).toString(); + } + + /** + * For scenarios in which links returned by the service are used by the client to poll for additional information, the + * client can specify the odata.callback preference to request that the service notify the client when data is + * available. + * <br /> + * The odata.callback preference can be specified: + * <ul> + * <li>when requesting asynchronous processing of a request with the respond-async preference, or</li> + * <li>on a GET request to a delta link.</li> + * </ul> + * <br /> + * The odata.callback preference MUST include the parameter url whose value is the URL of a callback endpoint to be + * invoked by the OData service when data is available. The syntax of the odata.callback preference is specified in + * [OData-ABNF]. For HTTP based callbacks, the OData service executes an HTTP GET request against the specified URL. + * <br /> + * Services that support odata.callback SHOULD support notifying the client through HTTP. Services can advertise + * callback support using the Capabilities.CallbackSupport annotation term defined in [OData-VocCap]. + * <br /> + * If the service applies the odata.callback preference it MUST include the odata.callback preference in the + * Preference-Applied response header. + * <br /> + * When the odata.callback preference is applied to asynchronous requests, the OData service invokes the callback + * endpoint once it has finished processing the request. The status monitor resource, returned in the Location header + * of the previously returned 202 Accepted response, can then be used to retrieve the results of the asynchronously + * executed request. + * <br /> + * When the odata.callback preference is specified on a GET request to a delta link and there are no changes + * available, the OData service returns a 202 Accepted response with a Location header specifying the delta link to be + * used to check for future updates. The OData service then invokes the specified callback endpoint once new changes + * become available. + * <br /> + * Combining respond-async, odata.callback and odata.track-changes preferences on a GET request to a delta-link might + * influence the response in a couple of ways. + * <ul> + * <li>If the service processes the request synchronously, and no updates are available, then the response is the same + * as if the respond-async hadn’t been specified and results in a response as described above.</li> + * <li>If the service processes the request asynchronously, then it responds with a 202 Accepted response specifying + * the URL to the status monitor resource as it would have with any other asynchronous request. Once the service has + * finished processing the asynchronous request to the delta link resource, if changes are available it invokes the + * specified callback endpoint. If no changes are available, the service SHOULD wait to notify the client until + * changes are available. Once notified, the client uses the status monitor resource from the Location header of the + * previously returned 202 Accepted response to retrieve the results. In case no updates were available after + * processing the initial request, the result will contain no updates and the client can use the delta-link contained + * in the result to retrieve the updates that have since become available.</li> + * </ul> + * <br /> + * If the consumer specifies the same URL as callback endpoint in multiple requests, the service MAY collate them into + * a single notification once additional data is available for any of the requests. However, the consumer MUST be + * prepared to deal with receiving up to as many notifications as it requested. + * <br /><br /> + * Example: using a HTTP callback endpoint to receive notification + * <br /><br /> + * Prefer: odata.callback; url="http://myserver/notfication/token/12345" + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String callback(final String url) { + return PreferenceNames.callback.isSupportedBy(serviceVersion).toString() + ";url=\"" + url + "\""; + } + + /** + * The odata.continue-on-error preference on a batch request is used to request that, upon encountering a request + * within the batch that returns an error, the service return the error for that request and continue processing + * additional requests within the batch. The syntax of the odata.continue-on-error preference is specified in + * [OData-ABNF]. + * <br /> + * If not specified, upon encountering an error the service MUST return the error within the batch and stop processing + * additional requests within the batch. + * <br /> + * A service MAY specify the support for the odata.continue-on-error preference using an annotation with term + * Capabilities.BatchContinueOnErrorSupported, see [OData-VocCap]. + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String continueOnError() { + return PreferenceNames.callback.isSupportedBy(serviceVersion).toString(); + } + + /** + * The odata.include-annotations preference in a request for data or metadata is used to specify the set of + * annotations the client requests to be included, where applicable, in the response. + * <br/> + * The value of the odata.include-annotations preference is a comma-separated list of namespaces or namespace + * qualified term names to include or exclude, with "*" representing all. The full syntax of the + * odata.include-annotations preference is defined in [OData-ABNF]. + * <br/> + * The most specific identifier always takes precedence. If the same identifier value is requested to both be excluded + * and included the behavior is undefined; the service MAY return or omit the specified vocabulary but MUST NOT raise + * an exception. + * <br/><br/> + * Example 1: a Prefer header requesting all annotations within a metadata document to be returned + * <br/><br/> + * Prefer: odata.include-annotations="*" + * <br/><br/> + * Example 2: a Prefer header requesting that no annotations are returned + * <br/><br/> + * Prefer: odata.include-annotations="-*" + * <br/><br/> + * Example 3: a Prefer header requesting that all annotations defined under the "display" namespace (recursively) be + * returned + * <br/><br/> + * Prefer: odata.include-annotations="display.*" + * <br/><br/> + * Example 4: a Prefer header requesting that the annotation with the term name subject within the display namespace + * be returned if applied + * <br/><br/> + * Prefer: odata.include-annotations="display.subject" + * <br/><br/> + * The odata.include-annotations preference is only a hint to the service. The service MAY ignore the preference and + * is free to decide whether or not to return annotations not specified in the odata.include-annotations preference. + * <br/> + * In the case that the client has specified the odata.include-annotations preference in the request, the service + * SHOULD include a Preference-Applied response header containing the odata.include-annotations preference to specify + * the annotations actually included, where applicable, in the response. This value may differ from the annotations + * requested in the Prefer header of the request. + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String includeAnnotations(final String value) { + return PreferenceNames.includeAnnotations.isSupportedBy(serviceVersion).toString() + "=" + value; + } + + /** + * The odata.maxpagesize preference is used to request that each collection within the response contain no more than + * the number of items specified as the positive integer value of this preference. The syntax of the odata.maxpagesize + * preference is specified in [OData-ABNF]. + * <br/><br/> + * Example: a request for customers and their orders would result in a response containing one collection with + * customer entities and for every customer a separate collection with order entities. The client could specify + * <br/> + * odata.maxpagesize=50 + * <br/>in order to request that each page of results contain a maximum of 50 customers, each with a maximum of 50 + * orders. + * <br/><br/> + * If a collection within the result contains more than the specified odata.maxpagesize, the collection SHOULD be a + * partial set of the results with a next link to the next page of results. The client MAY specify a different value + * for this preference with every request following a next link. + * <br/> + * In the example given above, the result page should include a next link for the customer collection, if there are + * more than 50 customers, and additional next links for all returned orders collections with more than 50 entities. + * <br/> + * If the client has specified the odata.maxpagesize preference in the request, and the service limits the number of + * items in collections within the response through server-driven paging, the service MAY include a Preference-Applied + * response header containing the odata.maxpagesize preference and the maximum page size applied. This value may + * differ from the value requested by the client. + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String maxPageSize(final int size) { + return PreferenceNames.maxPageSize.isSupportedBy(serviceVersion).toString() + "=" + size; + } + + /** + * The odata.track-changes preference is used to request that the service return a delta link that can subsequently be + * used to obtain changes (deltas) to this result. The syntax of the odata.track-changes preference is specified in + * [OData-ABNF]. + * <br /> + * For paged results, the preference MUST be specified on the initial request. Services MUST ignore the + * odata.track-changes preference if applied to the next link. + * <br /> + * The delta link MUST NOT be returned prior to the final page of results. + * <br /> + * The service includes a Preference-Applied response header in the first page of the response containing the + * odata.track-changes preference to signal that changes are being tracked. + * <br /> + * A service MAY specify the support for the odata.track-changes preference using an annotation with term + * Capabilities.ChangeTrackingSupport, see [OData-VocCap]. + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String trackChanges() { + return PreferenceNames.trackChanges.isSupportedBy(serviceVersion).toString(); + } + + /** + * The respond-async preference, as defined in [HTTP-Prefer], allows clients to request that the service process the + * request asynchronously. + * <br/> + * If the client has specified respond-async in the request, the service MAY process the request asynchronously and + * return a 202 Accepted response. + * <br/> + * The respond-async preference MAY be used for batch requests, but the service MUST ignore the respond-async + * preference for individual requests within a batch request. + * <br/> + * In the case that the service applies the respond-async preference it MUST include a Preference-Applied response + * header containing the respond-async preference. + * <br/> + * A service MAY specify the support for the respond-async preference using an annotation with term + * Capabilities.AsynchronousRequestsSupported, see [OData-VocCap]. + * <br/><br/> + * Example: a service receiving the following header might choose to respond + * <ul> + * <li>asynchronously if the synchronous processing of the request will take longer than 10 seconds</li> + * <li>synchronously after 5 seconds</li> + * <li>asynchronously (ignoring the wait preference)</li> + * <li>synchronously after 15 seconds (ignoring respond-async preference and the wait preference)</li> + * </ul> + * <br/> + * Prefer: respond-async, wait=10 + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String respondAsync() { + return PreferenceNames.respondAsync.isSupportedBy(serviceVersion).toString(); + } + + /** + * The wait preference, as defined in [HTTP-Prefer], is used to establish an upper bound on the length of time, in + * seconds, the client is prepared to wait for the service to process the request synchronously once it has been + * received. + * <br/> + * If the respond-async preference is also specified, the client requests that the service respond asynchronously + * after the specified length of time. + * <br/> + * If the respond-async preference has not been specified, the service MAY interpret the wait as a request to timeout + * after the specified period of time. + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String wait(final int value) { + return PreferenceNames.wait.isSupportedBy(serviceVersion).toString() + "=" + value; + } + + /** + * The return=representation and return=minimal preferences are defined in [HTTP-Prefer], + * <br/> + * In OData, return=representation or return=minimal is defined for use with a POST, PUT, or PATCH Data Modification + * Request other than to a stream property, or to an Action Request. Specifying a preference of return=representation + * or return=minimal in a GET or DELETE request, or any request to a stream property, SHOULD return a 4xx Client + * Error. + * <br/> + * A preference of return=representation or return=minimal is allowed on an individual Data Modification Request or + * Action Request within a batch, subject to the same restrictions, but SHOULD return a 4xx Client Error if specified + * on the batch request itself. + * <br/> + * A preference of return=minimal requests that the service invoke the request but does not return content in the + * response. The service MAY apply this preference by returning 204 No Content in which case it MAY include a + * Preference-Applied response header containing the return=minimal preference. + * <br/> + * A preference of return=representation requests that the service invokes the request and returns the modified + * entity. The service MAY apply this preference by returning the successfully modified resource in the body of the + * response, formatted according to the rules specified for the requested format. In this case the service MAY include + * a Preference-Applied response header containing the return=representation preference. + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String returnMinimal() { + return PreferenceNames.odataReturn.isSupportedBy(serviceVersion).toString() + "=minimal"; + } + + /** + * The return=representation and return=minimal preferences are defined in [HTTP-Prefer], + * <br/> + * In OData, return=representation or return=minimal is defined for use with a POST, PUT, or PATCH Data Modification + * Request other than to a stream property, or to an Action Request. Specifying a preference of return=representation + * or return=minimal in a GET or DELETE request, or any request to a stream property, SHOULD return a 4xx Client + * Error. + * <br/> + * A preference of return=representation or return=minimal is allowed on an individual Data Modification Request or + * Action Request within a batch, subject to the same restrictions, but SHOULD return a 4xx Client Error if specified + * on the batch request itself. + * <br/> + * A preference of return=minimal requests that the service invoke the request but does not return content in the + * response. The service MAY apply this preference by returning 204 No Content in which case it MAY include a + * Preference-Applied response header containing the return=minimal preference. + * <br/> + * A preference of return=representation requests that the service invokes the request and returns the modified + * entity. The service MAY apply this preference by returning the successfully modified resource in the body of the + * response, formatted according to the rules specified for the requested format. In this case the service MAY include + * a Preference-Applied response header containing the return=representation preference. + * <br/><br/> + * Supported by OData version 4.0 only. + * + * @see HeaderName#prefer + * @return preference. + */ + public String returnRepresentation() { + return PreferenceNames.odataReturn.isSupportedBy(serviceVersion).toString() + "=representation"; + } + + private static enum PreferenceNames { + + returnContent("return-content", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), + returnNoContent("return-no-content", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), + keyAsSegment("KeyAsSegment", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)), + allowEntityReferences("odata.allow-entityreferences", Arrays.asList(ODataServiceVersion.V40)), + callback("odata.callback", Arrays.asList(ODataServiceVersion.V40)), + continueOnError("odata.continue-on-error", Arrays.asList(ODataServiceVersion.V40)), + includeAnnotations("odata.include-annotations", Arrays.asList(ODataServiceVersion.V40)), + maxPageSize("odata.maxpagesize", Arrays.asList(ODataServiceVersion.V40)), + trackChanges("odata.track-changes", Arrays.asList(ODataServiceVersion.V40)), + respondAsync("respond-async", Arrays.asList(ODataServiceVersion.V40)), + wait("wait", Arrays.asList(ODataServiceVersion.V40)), + odataReturn("return", Arrays.asList(ODataServiceVersion.V40)); + + private final String preferenceName; + + private final List<ODataServiceVersion> supportedVersions; + + private PreferenceNames(final String preferenceName, final List<ODataServiceVersion> supportedVersions) { + this.preferenceName = preferenceName; + this.supportedVersions = supportedVersions; + } + + final PreferenceNames isSupportedBy(final ODataServiceVersion serviceVersion) { + if (!supportedVersions.contains(serviceVersion)) { + throw new ODataRuntimeException("Unsupported header " + this.toString()); + } + + return this; + } + + @Override + public String toString() { + return preferenceName; + } + } +} diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java index 8ea098c14..e9a2c900d 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java @@ -21,16 +21,20 @@ package org.apache.olingo.client.api.communication.request; import java.io.InputStream; import java.net.URI; import java.util.Collection; +import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.http.HttpMethod; /** * Abstract representation of an OData request. Get instance by using factories. * - * @see CUDRequestFactory - * @see RetrieveRequestFactory - * @see BatchRequestFactory - * @see InvokeRequestFactory - * @see StreamedRequestFactory + * @see org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory + * @see org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory + * @see org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory + * @see org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory + * @see org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory + * @see org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory + * @see org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory + * @see org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory */ public interface ODataRequest { @@ -175,6 +179,16 @@ public interface ODataRequest { */ ODataRequest addCustomHeader(final String name, final String value); + /** + * Adds a custom OData request header. The method fails in case of the header name is not supported by the current + * working version. + * + * @param name header name. + * @param value header value. + * @return current object + */ + ODataRequest addCustomHeader(final HeaderName name, final String value); + /** * Gets byte array representation of the full request header. * 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 6f6f502dd..b6c74ddde 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,11 +20,10 @@ package org.apache.olingo.client.api.communication.request.cud; import java.io.Serializable; import java.net.URI; -import org.apache.olingo.client.api.communication.request.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; /** * OData request factory class. @@ -36,21 +35,24 @@ 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, ODataEntity entity); + <E extends CommonODataEntity> ODataEntityCreateRequest<E> getEntityCreateRequest(URI targetURI, E 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. */ - ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UpdateType 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. @@ -59,7 +61,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. @@ -82,7 +84,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. @@ -95,7 +97,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. @@ -106,7 +108,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. 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 02f41e7c9..73471b910 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> { } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java similarity index 70% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java rename to lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java index 898b6b284..eba17e0dd 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java @@ -16,19 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.commons.api.edm; +package org.apache.olingo.client.api.communication.request.cud; -import org.apache.olingo.commons.api.edm.geo.Geospatial; +import org.apache.olingo.client.api.http.HttpMethod; -public interface EdmGeospatialType extends EdmType { - - String EDM_NAMESPACE = EdmPrimitiveType.EDM_NAMESPACE; +public interface UpdateType { /** - * Returns the Java type for this EDM geospatial type. + * Gets HTTP request method. * - * @return the geospatial Java type + * @return HTTP request method. */ - Class<? extends Geospatial> getJavaType(); - + HttpMethod getMethod(); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/UpdateType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/UpdateType.java similarity index 89% rename from lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/UpdateType.java rename to lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/UpdateType.java index 0e6a83173..4bcb15081 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/UpdateType.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/UpdateType.java @@ -16,14 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.api.communication.request; +package org.apache.olingo.client.api.communication.request.cud.v3; import org.apache.olingo.client.api.http.HttpMethod; /** * Update type. */ -public enum UpdateType { +public enum UpdateType implements org.apache.olingo.client.api.communication.request.cud.UpdateType { /** * Replace all and remove missing attributes. @@ -49,6 +49,7 @@ public enum UpdateType { * * @return HTTP request method. */ + @Override public HttpMethod getMethod() { return method; } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/UpdateType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/UpdateType.java new file mode 100644 index 000000000..9d8ec2508 --- /dev/null +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/UpdateType.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.client.api.communication.request.cud.v4; + +import org.apache.olingo.client.api.http.HttpMethod; + +/** + * Update type. + */ +public enum UpdateType implements org.apache.olingo.client.api.communication.request.cud.UpdateType { + + /** + * Replace all and remove missing attributes. + */ + REPLACE(HttpMethod.PUT), + /** + * Differential update with only specified input property values to be replaced. + */ + PATCH(HttpMethod.PATCH); + + private final HttpMethod method; + + private UpdateType(final HttpMethod method) { + this.method = method; + } + + /** + * Gets HTTP request method. + * + * @return HTTP request method. + */ + @Override + public HttpMethod getMethod() { + return method; + } +} 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 89777da55..69e53e7e4 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. @@ -27,79 +30,97 @@ import java.net.URI; public interface CommonRetrieveRequestFactory extends Serializable { /** - * Gets a service document request instance. + * Gets a metadata request instance. + * <br/> + * Compared to {@link #getMetadataRequest(java.lang.String)}, this method returns a request instance for fetching + * low-level metadata representation. * * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data * service. - * @return new ODataServiceDocumentRequest instance. + * @return new {@link XMLMetadataRequest} instance. */ - ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot); + XMLMetadataRequest getXMLMetadataRequest(String serviceRoot); /** * Gets a metadata request instance. * * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data * service. - * @return new ODataMetadataRequest instance. + * @return new {@link EdmMetadataRequest} instance. */ - ODataMetadataRequest getMetadataRequest(String serviceRoot); + EdmMetadataRequest getMetadataRequest(String serviceRoot); /** - * Gets a query request returning a set of one or more OData entities. + * Gets a service document request instance. * - * @param query query to be performed. - * @return new ODataEntitySetRequest instance. + * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data + * service. + * @return new {@link ODataServiceDocumentRequest} instance. */ - ODataEntitySetRequest getEntitySetRequest(URI query); + 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. + * @return new {@link ODataEntitySetRequest} instance. + */ + <T extends CommonODataEntitySet> ODataEntitySetRequest<T> getEntitySetRequest(URI uri); + + /** + * 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. * - * @param query query to be performed. - * @return new ODataEntitySetIteratorRequest instance. + * @param <ES> concreate ODataEntitySet implementation. + * @param <E> concrete ODataEntity implementation. + * @param uri request URI. + * @return new {@link ODataEntitySetIteratorRequest} instance. */ - ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI query); + <ES extends CommonODataEntitySet, E extends CommonODataEntity> + 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 query query to be performed. - * @return new ODataEntityRequest instance. + * @param <T> concrete ODataEntity implementation. + * @param uri request URI. + * @return new {@link ODataEntityRequest} instance. */ - ODataEntityRequest getEntityRequest(URI query); + <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 query query to be performed. - * @return new ODataPropertyRequest instance. + * @param <T> concrete ODataProperty implementation. + * @param uri request URI. + * @return new {@link ODataPropertyRequest} instance. */ - ODataPropertyRequest getPropertyRequest(URI query); + <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 query query to be performed. - * @return new ODataValueRequest instance. + * @param uri request URI. + * @return new {@link ODataValueRequest} instance. */ - ODataValueRequest getValueRequest(URI query); + ODataValueRequest getValueRequest(URI uri); /** - * Gets a query request returning a media stream. + * Gets a uri request returning a media stream. * - * @param query query to be performed. - * @return new ODataMediaRequest instance. + * @param uri request URI. + * @return new {@link ODataMediaRequest} instance. */ - ODataMediaRequest getMediaRequest(URI query); + ODataMediaRequest getMediaRequest(URI uri); /** * Implements a raw request request without specifying any return type. * - * @param uri query to be performed. - * @return new ODataRawRequest instance. + * @param uri request URI. + * @return new {@link ODataRawRequest} instance. */ ODataRawRequest getRawRequest(URI uri); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/EdmMetadataRequest.java similarity index 86% rename from lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java rename to lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/EdmMetadataRequest.java index 3dcc81b6b..d4ea45b18 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/EdmMetadataRequest.java @@ -18,11 +18,11 @@ */ package org.apache.olingo.client.api.communication.request.retrieve; -import org.apache.olingo.commons.api.format.ODataPubFormat; import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.commons.api.format.ODataFormat; /** * This class implements a metadata query request. */ -public interface ODataMetadataRequest extends ODataRetrieveRequest<Edm, ODataPubFormat> { +public interface EdmMetadataRequest extends ODataRetrieveRequest<Edm, ODataFormat> { } 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 a22f82c02..aee96026e 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> { } 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 dd2cf46da..724b6441e 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> { } 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 fbafafd42..c7e196403 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,14 @@ */ 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. + * This interface describes an OData EntitySet query request. + * + * @param <ES> concrete ODataEntitySet implementation */ -public interface ODataEntitySetRequest extends ODataRetrieveRequest<ODataEntitySet, ODataPubFormat> { +public interface ODataEntitySetRequest<ES extends CommonODataEntitySet> + extends ODataRetrieveRequest<ES, ODataPubFormat> { } 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 7492e11ab..f61783b92 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> { } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/XMLMetadataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/XMLMetadataRequest.java new file mode 100644 index 000000000..fbeff8f4c --- /dev/null +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/XMLMetadataRequest.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.client.api.communication.request.retrieve; + +import java.util.List; +import org.apache.olingo.client.api.edm.xml.Schema; +import org.apache.olingo.commons.api.format.ODataFormat; + +/** + * This class implements an XML metadata request. + */ +public interface XMLMetadataRequest extends ODataRetrieveRequest<List<? extends Schema>, ODataFormat> { +} 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 a0d667ae5..5adc932b0 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,11 +20,31 @@ 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; +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 { + @Override + ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri); + + @Override + ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri); + + @Override + ODataEntityRequest<ODataEntity> getEntityRequest(URI uri); + + @Override + 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. 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 55005cd68..ab8dadecf 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,28 @@ */ 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; +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 + ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri); + + @Override + ODataEntityRequest<ODataEntity> getEntityRequest(URI uri); + + @Override + ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri); } 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 5fd7fb81b..678b8948e 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,19 +18,20 @@ */ 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. + * 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. */ - ODataEntity getBody(); + E getBody(); } 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 6b84630c6..59b011278 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(); } 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 ea3b8b7ce..c29193bc3 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(); } 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 f55dac81c..97aab03e3 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(); } 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 23bfc1e09..61f5dbdb4 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(); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java index 65434eccc..5498d1b57 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java @@ -19,6 +19,7 @@ package org.apache.olingo.client.api.communication.response; import java.io.InputStream; +import java.net.URI; import java.util.Collection; import java.util.Map; import org.apache.olingo.client.api.communication.header.HeaderName; @@ -58,6 +59,30 @@ public interface ODataResponse { * @return ETag header value, if provided */ String getEtag(); + + /** + * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a + * fragment identifying the relevant portion of the metadata document. + * <br /> + * Request payloads generally do not require context URLs as the type of the payload can generally be determined from + * the request URL. + * <br /> + * For details on how the context URL is used to describe a payload, see the relevant sections in the particular + * format. + * + * @return context URL. + */ + URI getContextURL(); + + /** + * An ETag header MAY also be returned on a metadata document request or service document request to allow the client + * subsequently to make a conditional request for the metadata or service document. Clients can also compare the value + * of the ETag header returned from a metadata document request to the metadata ETag returned in a response in order + * to verify the version of the metadata used to generate that response. + * + * @return metadata ETag. + */ + String getMetadataETag(); /** * Gets the content type. 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 d545567a6..a6deb49e4 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 @@ -37,20 +37,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. * @@ -134,5 +120,4 @@ public interface ServiceDocument { * @return related service document with given title if found, otherwise null */ ServiceDocumentItem getRelatedServiceDocumentByTitle(String title); - } 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 9d720bf42..107816f64 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; @@ -41,8 +41,12 @@ 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 implements Iterator<ODataEntity> { +public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends CommonODataEntity> + implements Iterator<E> { /** * Logger. @@ -59,7 +63,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> { private Entry cached; - private ODataEntitySet entitySet; + private ES entitySet; private final ByteArrayOutputStream osFeed; @@ -104,6 +108,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> { * {@inheritDoc } */ @Override + @SuppressWarnings("unchecked") public boolean hasNext() { if (available && cached == null) { if (format == ODataPubFormat.ATOM) { @@ -114,7 +119,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> { if (cached == null) { available = false; - entitySet = odataClient.getReader(). + entitySet = (ES) odataClient.getReader(). readEntitySet(new ByteArrayInputStream(osFeed.toByteArray()), format); close(); } @@ -127,9 +132,10 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> { * {@inheritDoc } */ @Override - public ODataEntity next() { + public E next() { if (hasNext()) { - final ODataEntity res = odataClient.getBinder().getODataEntity(cached); + @SuppressWarnings("unchecked") + final E res = (E) odataClient.getBinder().getODataEntity(cached); cached = null; return res; } @@ -170,7 +176,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> { Entry jsonEntry = null; try { - int c = 0; + int c; boolean foundNewOne = false; @@ -203,7 +209,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> { if (c >= 0) { jsonEntry = odataClient.getDeserializer().toEntry( - new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.JSON); + new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.JSON).getObject(); } } else { while ((c = input.read()) >= 0) { @@ -237,7 +243,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> { if (consume(input, "</entry>", entry, true) >= 0) { atomEntry = odataClient.getDeserializer(). - toEntry(new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.ATOM); + toEntry(new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.ATOM).getObject(); } } } catch (Exception e) { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java index ad482fb33..24b6e60ff 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java @@ -21,6 +21,7 @@ package org.apache.olingo.client.api.op; import java.io.InputStream; import org.apache.olingo.client.api.data.ServiceDocument; import org.apache.olingo.client.api.edm.xml.XMLMetadata; +import org.apache.olingo.commons.api.data.Container; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.op.CommonODataDeserializer; @@ -35,5 +36,5 @@ public interface ClientODataDeserializer extends CommonODataDeserializer { * @param format OData service document format. * @return <tt>ServiceDocument</tt> object. */ - ServiceDocument toServiceDocument(InputStream input, ODataFormat format); + Container<ServiceDocument> toServiceDocument(InputStream input, ODataFormat format); } 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 38fe16f56..14fa946b9 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); } 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 829c5a79d..923ac231b 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 @@ -20,14 +20,17 @@ package org.apache.olingo.client.api.op; import java.io.InputStream; import java.io.Serializable; +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; import org.apache.olingo.commons.api.format.ODataPubFormat; -import org.apache.olingo.commons.api.edm.Edm; /** * OData reader. @@ -46,6 +49,15 @@ public interface CommonODataReader extends Serializable { */ Edm readMetadata(InputStream input); + /** + * Parses a stream into metadata representation, including referenced metadata documents. + * + * @param xmlSchemas XML representation of the requested metadata document + any other referenced (via + * <tt><edmx:Reference/></tt>) metadata document + * @return metadata representation. + */ + Edm readMetadata(List<? extends Schema> xmlSchemas); + /** * Parses an OData service document. * @@ -62,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. @@ -71,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. @@ -80,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. @@ -100,5 +112,5 @@ public interface CommonODataReader extends Serializable { * @param reference reference. * @return read object. */ - <T> T read(InputStream src, String format, Class<T> reference); + <T> Container<T> read(InputStream src, String format, Class<T> reference); } 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 b83b2cd72..a7ead37b2 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. 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 6ea90ba0f..52cb62513 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. * diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java index b12b104d4..bc16b74c4 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java @@ -20,6 +20,7 @@ package org.apache.olingo.client.api.op.v3; import java.io.InputStream; import org.apache.olingo.client.api.op.ClientODataDeserializer; +import org.apache.olingo.commons.api.data.Container; import org.apache.olingo.commons.api.data.v3.LinkCollection; import org.apache.olingo.commons.api.format.ODataFormat; @@ -32,6 +33,6 @@ public interface ODataDeserializer extends ClientODataDeserializer { * @param format OData format. * @return de-serialized links. */ - LinkCollection toLinkCollection(InputStream input, ODataFormat format); + Container<LinkCollection> toLinkCollection(InputStream input, ODataFormat format); } 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 7049617e0..2e72ce41d 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. * 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 1397c473d..f51c79898 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); } 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 25d989d75..c976c05b0 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); } 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 3f10262a5..6a8ce0e14 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,10 +40,19 @@ 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. * @@ -220,5 +228,4 @@ public interface CommonURIBuilder<UB extends CommonURIBuilder<?>> { * @return OData URI. */ URI build(); - } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/SegmentType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/SegmentType.java index a3e5a1577..5da7f09d2 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/SegmentType.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/SegmentType.java @@ -34,6 +34,7 @@ public enum SegmentType { NAVIGATION, DERIVED_ENTITY_TYPE, VALUE("$value"), + COUNT("$count"), BOUND_OPERATION, UNBOUND_OPERATION, METADATA("$metadata"), diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/URIBuilder.java index 72a0c03dd..d81edbf30 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/URIBuilder.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/URIBuilder.java @@ -42,8 +42,7 @@ public interface URIBuilder extends CommonURIBuilder<URIBuilder> { * * @param inlineCount value * @return current URIBuilder instance - * @see QueryOption#INLINECOUNT + * @see org.apache.olingo.client.api.uri.QueryOption#INLINECOUNT */ URIBuilder inlineCount(InlineCount inlineCount); - } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java index 5fc8a1d90..9985ce884 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java @@ -18,10 +18,31 @@ */ package org.apache.olingo.client.api.uri.v4; +import java.util.Map; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.olingo.commons.api.edm.EdmEnumType; import org.apache.olingo.client.api.uri.CommonURIBuilder; public interface URIBuilder extends CommonURIBuilder<URIBuilder> { + /** + * Appends enum key segment to the URI. + * + * @param enumType enum type + * @param memberName enum member name + * @return current URIBuilder instance + */ + URIBuilder appendKeySegment(EdmEnumType enumType, String memberName); + + /** + * Appends key segment to the URI, for multiple keys. + * + * @param enumValues enum segment values. + * @param segmentValues segment values. + * @return current URIBuilder instance + */ + URIBuilder appendKeySegment(Map<String, Pair<EdmEnumType, String>> enumValues, Map<String, Object> segmentValues); + /** * Appends Singleton segment to the URI. * @@ -65,7 +86,7 @@ public interface URIBuilder extends CommonURIBuilder<URIBuilder> { * * @param idValue opaque token. * @return current URIBuilder instance - * @see QueryOption#ID + * @see org.apache.olingo.client.api.uri.QueryOption#ID */ URIBuilder id(String idValue); @@ -74,7 +95,7 @@ public interface URIBuilder extends CommonURIBuilder<URIBuilder> { * * @param value true or false * @return current URIBuilder instance - * @see QueryOption#COUNT + * @see org.apache.olingo.client.api.uri.QueryOption#COUNT */ URIBuilder count(boolean value); @@ -83,7 +104,19 @@ public interface URIBuilder extends CommonURIBuilder<URIBuilder> { * * @param expression search expression * @return current URIBuilder instance - * @see QueryOption#SEARCH + * @see org.apache.olingo.client.api.uri.QueryOption#SEARCH */ URIBuilder search(String expression); + + /** + * The set of expanded entities can be refined through the application of expand options, expressed as a + * semicolon-separated list of system query options, enclosed in parentheses, see [OData-URL]. + * + * @param expandItem item to be expanded. + * @param options System query options. Allowed query options are: $filter, $select, $orderby, $skip, $top, $count, + * $search, $expand, and $levels. + * @return current URIBuilder instance. + * @see org.apache.olingo.client.api.uri.QueryOption#EXPAND + */ + URIBuilder expandWithOptions(String expandItem, Map<String, Object> options); } 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 595979633..81bf6dcbb 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,9 +29,13 @@ 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(); @@ -41,15 +45,15 @@ public interface ODataClient extends CommonODataClient { @Override ODataBinder getBinder(); - @Override - Configuration getConfiguration(); - @Override URIBuilder getURIBuilder(String serviceRoot); @Override FilterFactory getFilterFactory(); + @Override + ODataObjectFactory getObjectFactory(); + @Override RetrieveRequestFactory getRetrieveRequestFactory(); 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 afe3c7008..51abf9963 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,9 +29,13 @@ 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(); @@ -41,15 +45,15 @@ public interface ODataClient extends CommonODataClient { @Override ODataBinder getBinder(); - @Override - Configuration getConfiguration(); - @Override URIBuilder getURIBuilder(String serviceRoot); @Override FilterFactory getFilterFactory(); + @Override + ODataObjectFactory getObjectFactory(); + @Override RetrieveRequestFactory getRetrieveRequestFactory(); 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 419709484..57b24dfa9 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,11 +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.client.core.domain.ODataGeospatialValueImpl; -import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl; -import org.apache.olingo.commons.core.op.ODataObjectFactoryImpl; import org.apache.olingo.client.core.op.ODataWriterImpl; public abstract class AbstractODataClient implements CommonODataClient { @@ -32,26 +28,9 @@ public abstract class AbstractODataClient implements CommonODataClient { private final ODataWriter writer = new ODataWriterImpl(this); - private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion()); - - @Override - public ODataPrimitiveValueImpl.BuilderImpl getPrimitiveValueBuilder() { - return new ODataPrimitiveValueImpl.BuilderImpl(this.getServiceVersion()); - } - - @Override - public ODataGeospatialValueImpl.BuilderImpl getGeospatialValueBuilder() { - return new ODataGeospatialValueImpl.BuilderImpl(); - } - @Override public ODataWriter getWriter() { return writer; } - @Override - public ODataObjectFactory getObjectFactory() { - return objectFactory; - } - } 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 3e6c1bbd3..12696a6d6 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; @@ -38,14 +37,10 @@ import org.apache.olingo.client.api.v3.Configuration; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.ODataServerErrorException; import org.apache.olingo.client.api.communication.header.HeaderName; -import org.apache.olingo.client.api.communication.header.ODataHeaderValues; import org.apache.olingo.client.api.communication.header.ODataHeaders; +import org.apache.olingo.client.api.communication.header.ODataPreferences; import org.apache.olingo.client.api.communication.request.ODataRequest; import org.apache.olingo.client.api.communication.request.ODataStreamer; -import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory; -import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory; -import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory; -import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory; import org.apache.olingo.client.api.communication.response.ODataResponse; import org.apache.olingo.commons.api.format.Format; import org.apache.olingo.client.api.http.HttpClientException; @@ -56,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; @@ -66,10 +61,14 @@ import org.slf4j.LoggerFactory; * * @param <T> Accepted content-type formats by the request in object. * - * @see CUDRequestFactory - * @see BatchRequestFactory - * @see InvokeRequestFactory - * @see StreamedRequestFactory + * @see org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory + * @see org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory + * @see org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory + * @see org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory + * @see org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory + * @see org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory + * @see org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory + * @see org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory */ public class ODataRequestImpl<T extends Format> implements ODataRequest { @@ -80,7 +79,7 @@ public class ODataRequestImpl<T extends Format> implements ODataRequest { protected final CommonODataClient odataClient; - protected final Class<T> formatRef; + private final Class<T> formatRef; /** * OData request method. @@ -250,6 +249,15 @@ public class ODataRequestImpl<T extends Format> implements ODataRequest { return this; } + /** + * {@inheritDoc} + */ + @Override + public ODataRequest addCustomHeader(final HeaderName name, final String value) { + odataHeaders.setHeader(name, value); + return this; + } + /** * {@inheritDoc} */ @@ -384,7 +392,8 @@ public class ODataRequestImpl<T extends Format> implements ODataRequest { if (odataClient.getServiceVersion() == ODataServiceVersion.V30 && ((Configuration) odataClient.getConfiguration()).isKeyAsSegment()) { addCustomHeader( - HeaderName.dataServiceUrlConventions.toString(), ODataHeaderValues.keyAsSegment); + HeaderName.dataServiceUrlConventions.toString(), + new ODataPreferences(odataClient.getServiceVersion()).keyAsSegment()); } // Add all available headers @@ -469,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; 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 cb82cbd99..16eecad32 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 @@ -20,7 +20,6 @@ package org.apache.olingo.client.core.communication.request.cud; import java.net.URI; import org.apache.olingo.client.api.CommonODataClient; -import org.apache.olingo.client.api.communication.request.UpdateType; import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory; import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; @@ -29,10 +28,11 @@ import org.apache.olingo.client.api.communication.request.cud.ODataLinkCreateReq import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateRequest; import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest; import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.client.api.communication.request.cud.UpdateType; +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,15 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto } @Override - public ODataEntityCreateRequest getEntityCreateRequest(final URI targetURI, final ODataEntity 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 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 +69,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 +104,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 +124,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 +144,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"); 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 c22b5de81..18485ae9c 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,23 +28,28 @@ 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; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; import org.apache.olingo.client.core.communication.response.AbstractODataResponse; +import org.apache.olingo.commons.api.data.Container; +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 ODataEntity entity; + private final E entity; /** * Constructor. @@ -53,7 +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 ODataEntity entity) { + ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final E entity) { super(odataClient, ODataPubFormat.class, HttpMethod.POST, targetURI); this.entity = entity; } @@ -70,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)); @@ -84,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 ODataEntity entity = null; + private E entity = null; /** * Constructor. @@ -94,6 +99,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat * Just to create response templates to be initialized from batch. */ private ODataEntityCreateResponseImpl() { + super(); } /** @@ -110,11 +116,14 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat * {@inheritDoc } */ @Override - public ODataEntity getBody() { + @SuppressWarnings("unchecked") + public E getBody() { if (entity == null) { try { - entity = odataClient.getReader(). - readEntity(getRawResponse(), ODataPubFormat.fromString(getAccept())); + final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), + ODataPubFormat.fromString(getAccept())); + + entity = (E) odataClient.getBinder().getODataEntity(extractFromContainer(container)); } finally { this.close(); } 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 565c59e37..dde98a4d9 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,12 +28,14 @@ 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; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; import org.apache.olingo.client.core.communication.response.AbstractODataResponse; +import org.apache.olingo.commons.api.data.Container; +import org.apache.olingo.commons.api.data.Entry; /** * This class implements an OData update request. @@ -44,7 +46,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat /** * Changes to be applied. */ - private final ODataEntity changes; + private final CommonODataEntity changes; /** * Constructor. @@ -55,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; @@ -92,7 +94,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat /** * Changes. */ - private ODataEntity entity = null; + private CommonODataEntity entity = null; /** * Constructor. @@ -116,11 +118,13 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat * {@inheritDoc ] */ @Override - public ODataEntity getBody() { + public CommonODataEntity getBody() { if (entity == null) { try { - entity = odataClient.getReader(). - readEntity(getRawResponse(), ODataPubFormat.fromString(getAccept())); + final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), + ODataPubFormat.fromString(getAccept())); + + entity = odataClient.getBinder().getODataEntity(extractFromContainer(container)); } finally { this.close(); } 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 b3be3eb2f..7345d300e 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,12 +28,14 @@ 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; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; import org.apache.olingo.client.core.communication.response.AbstractODataResponse; +import org.apache.olingo.commons.api.data.Container; +import org.apache.olingo.commons.api.data.Property; /** * This class implements an OData update entity property request. @@ -44,7 +46,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD /** * Value to be created. */ - private final ODataProperty property; + private final CommonODataProperty property; /** * Constructor. @@ -55,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 @@ -90,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. @@ -114,11 +116,13 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD * {@inheritDoc } */ @Override - public ODataProperty getBody() { + public CommonODataProperty getBody() { if (property == null) { try { - property = odataClient.getReader(). - readProperty(getRawResponse(), ODataFormat.fromString(getAccept())); + final Container<Property> container = odataClient.getDeserializer().toProperty(getRawResponse(), + ODataFormat.fromString(getAccept())); + + property = odataClient.getBinder().getODataProperty(extractFromContainer(container)); } finally { this.close(); } 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 d424d6281..660f1e313 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.client.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())). 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 ac6d1627b..4e7be37ee 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) - ? ODataFormat.XML.toString() + 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); } } @@ -153,7 +151,7 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult> throw new IllegalArgumentException("Only primitive values can be passed via GET"); } - uriBuilder.addParameter(param.getKey(), param.getValue().toString()); + uriBuilder.addParameter(param.getKey(), URIUtils.escape(odataClient.getServiceVersion(), param.getValue())); } try { ((HttpRequestBase) this.request).setURI(uriBuilder.build()); @@ -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())); } 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 2487dd9fa..87e8c76a4 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); } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java new file mode 100644 index 000000000..c851b49fd --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.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.client.core.communication.request.retrieve; + +import java.net.URI; +import org.apache.http.entity.ContentType; +import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.communication.request.ODataRequest; +import org.apache.olingo.commons.api.format.ODataFormat; + +public abstract class AbstractMetadataRequestImpl<V> extends AbstractODataRetrieveRequest<V, ODataFormat> { + + public AbstractMetadataRequestImpl(final CommonODataClient odataClient, final URI query) { + super(odataClient, ODataFormat.class, query); + super.setAccept(ContentType.APPLICATION_XML.getMimeType()); + super.setContentType(ContentType.APPLICATION_XML.getMimeType()); + } + + @Override + public ODataFormat getDefaultFormat() { + return ODataFormat.XML; + } + + @Override + public ODataRequest setAccept(final String value) { + // do nothing: Accept is application/xml + return this; + } + + @Override + public ODataRequest setContentType(final String value) { + // do nothing: Content-Type is application/xml + return this; + } + +} diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java index 7fd396667..53e46c16b 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java @@ -89,6 +89,10 @@ public abstract class AbstractODataRetrieveRequest<V, T extends Format> super(client, res); } + protected HttpResponse getHttpResponse() { + return res; + } + /** * {@inheritDoc } */ 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 ddbfd1049..d5e031978 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,8 @@ 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.ODataMetadataRequest; -import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest; +import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest; 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,33 +39,13 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe } @Override - public ODataEntitySetRequest getEntitySetRequest(final URI query) { - return new ODataEntitySetRequestImpl(client, query); + public ODataValueRequest getValueRequest(final URI uri) { + return new ODataValueRequestImpl(client, uri); } @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); - } - - @Override - public ODataMediaRequest getMediaRequest(final URI query) { - return new ODataMediaRequestImpl(client, query); + public ODataMediaRequest getMediaRequest(final URI uri) { + return new ODataMediaRequestImpl(client, uri); } @Override @@ -78,8 +54,9 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe } @Override - public ODataMetadataRequest getMetadataRequest(final String serviceRoot) { - return new ODataMetadataRequestImpl(client, client.getURIBuilder(serviceRoot).appendMetadataSegment().build()); + public EdmMetadataRequest getMetadataRequest(final String serviceRoot) { + return new EdmMetadataRequestImpl(client, serviceRoot, + client.getURIBuilder(serviceRoot).appendMetadataSegment().build()); } @Override diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java new file mode 100644 index 000000000..96df2d6fa --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.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.communication.request.retrieve; + +import java.net.URI; +import java.util.List; +import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest; +import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; +import org.apache.olingo.client.api.edm.xml.Schema; +import org.apache.olingo.commons.api.edm.Edm; + +/** + * This class implements a metadata query request. + */ +class EdmMetadataRequestImpl extends AbstractMetadataRequestImpl<Edm> implements EdmMetadataRequest { + + private final String serviceRoot; + + /** + * Constructor. + * + * @param odataClient client instance getting this request + * @param uri metadata URI. + */ + EdmMetadataRequestImpl(final CommonODataClient odataClient, final String serviceRoot, final URI uri) { + super(odataClient, uri); + this.serviceRoot = serviceRoot; + } + + @Override + public ODataRetrieveResponse<Edm> execute() { + final ODataRetrieveResponse<List<? extends Schema>> xmlMetadataResponse = + odataClient.getRetrieveRequestFactory().getXMLMetadataRequest(serviceRoot).execute(); + + return new ODataRetrieveResponseImpl() { + private Edm metadata = null; + + @Override + public void close() { + xmlMetadataResponse.close(); + } + + @Override + public Edm getBody() { + if (metadata == null) { + try { + metadata = odataClient.getReader().readMetadata(xmlMetadataResponse.getBody()); + } finally { + this.close(); + } + } + return metadata; + } + }; + } +} 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 447f54346..141b82e0c 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 @@ -24,14 +24,16 @@ import org.apache.http.client.HttpClient; import org.apache.olingo.client.api.CommonODataClient; 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.data.Container; +import org.apache.olingo.commons.api.data.Entry; +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. @@ -39,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); } @@ -47,7 +49,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn * {@inheritDoc } */ @Override - public ODataRetrieveResponse<ODataEntity> execute() { + public ODataRetrieveResponse<T> execute() { return new ODataEntityResponseImpl(httpClient, doExecute()); } @@ -56,7 +58,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn */ public class ODataEntityResponseImpl extends ODataRetrieveResponseImpl { - private ODataEntity entity = null; + private T entity = null; /** * Constructor. @@ -80,11 +82,14 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn * {@inheritDoc } */ @Override - public ODataEntity getBody() { + @SuppressWarnings("unchecked") + public T getBody() { if (entity == null) { try { - entity = odataClient.getReader(). - readEntity(getRawResponse(), ODataPubFormat.fromString(getContentType())); + final Container<Entry> container = + odataClient.getDeserializer().toEntry(getRawResponse(), ODataPubFormat.fromString(getContentType())); + + entity = (T) odataClient.getBinder().getODataEntity(extractFromContainer(container)); } finally { this.close(); } 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 bfdddef8f..a1e9a8bed 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; 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 ef191bad2..fb571e908 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 @@ -24,16 +24,20 @@ import org.apache.http.client.HttpClient; import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.data.Container; +import org.apache.olingo.commons.api.data.Feed; +import org.apache.olingo.commons.api.domain.CommonODataEntitySet; import org.apache.olingo.commons.api.format.ODataPubFormat; /** * This class implements an OData EntitySet query request. + * + * @param <ES> concrete ODataEntitySet implementation */ -public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODataEntitySet, ODataPubFormat> - implements ODataEntitySetRequest { +public class ODataEntitySetRequestImpl<ES extends CommonODataEntitySet> + extends AbstractODataRetrieveRequest<ES, ODataPubFormat> implements ODataEntitySetRequest<ES> { - private ODataEntitySet feed = null; + private ES entitySet = null; /** * Private constructor. @@ -41,7 +45,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); } @@ -49,7 +53,7 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat * {@inheritDoc } */ @Override - public ODataRetrieveResponse<ODataEntitySet> execute() { + public ODataRetrieveResponse<ES> execute() { final HttpResponse res = doExecute(); return new ODataEntitySetResponseImpl(httpClient, res); } @@ -65,6 +69,7 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat * Just to create response templates to be initialized from batch. */ private ODataEntitySetResponseImpl() { + super(); } /** @@ -82,16 +87,18 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat */ @Override @SuppressWarnings("unchecked") - public ODataEntitySet getBody() { - if (feed == null) { + public ES getBody() { + if (entitySet == null) { try { - feed = odataClient.getReader(). - readEntitySet(getRawResponse(), ODataPubFormat.fromString(getContentType())); + final Container<Feed> container = + odataClient.getDeserializer().toFeed(getRawResponse(), ODataPubFormat.fromString(getContentType())); + + entitySet = (ES) odataClient.getBinder().getODataEntitySet(extractFromContainer(container)); } finally { this.close(); } } - return feed; + return entitySet; } } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java deleted file mode 100644 index d5ee545cf..000000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java +++ /dev/null @@ -1,108 +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.communication.request.retrieve; - -import java.net.URI; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.entity.ContentType; -import org.apache.olingo.client.api.CommonODataClient; -import org.apache.olingo.client.api.communication.request.ODataRequest; -import org.apache.olingo.client.api.communication.request.retrieve.ODataMetadataRequest; -import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; -import org.apache.olingo.commons.api.format.ODataPubFormat; -import org.apache.olingo.commons.api.edm.Edm; - -/** - * This class implements a metadata query request. - */ -class ODataMetadataRequestImpl extends AbstractODataRetrieveRequest<Edm, ODataPubFormat> - implements ODataMetadataRequest { - - /** - * Constructor. - * - * @param odataClient client instance getting this request - * @param uri metadata URI. - */ - ODataMetadataRequestImpl(final CommonODataClient odataClient, final URI uri) { - super(odataClient, ODataPubFormat.class, uri); - super.setAccept(ContentType.APPLICATION_XML.getMimeType()); - super.setContentType(ContentType.APPLICATION_XML.getMimeType()); - } - - @Override - public ODataRequest setAccept(final String value) { - // do nothing: Accept is application/XML - return this; - } - - @Override - public ODataRequest setContentType(final String value) { - // do nothing: Accept is application/XML - return this; - } - - @Override - public ODataRetrieveResponse<Edm> execute() { - final HttpResponse res = doExecute(); - return new ODataMetadataResponseImpl(httpClient, res); - } - - /** - * Response class about an ODataMetadataRequest. - */ - protected class ODataMetadataResponseImpl extends ODataRetrieveResponseImpl { - - private Edm metadata = null; - - /** - * Constructor. - * <p> - * Just to create response templates to be initialized from batch. - */ - public ODataMetadataResponseImpl() { - } - - /** - * Constructor. - * - * @param client HTTP client. - * @param res HTTP response. - */ - private ODataMetadataResponseImpl(final HttpClient client, final HttpResponse res) { - super(client, res); - } - - /** - * {@inheritDoc } - */ - @Override - public Edm getBody() { - if (metadata == null) { - try { - metadata = odataClient.getReader().readMetadata(getRawResponse()); - } finally { - this.close(); - } - } - return metadata; - } - } -} 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 a768906f1..e8f5ae3de 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,15 +25,17 @@ 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; +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. @@ -41,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); } @@ -49,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. @@ -80,11 +82,15 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData * {@inheritDoc } */ @Override - public ODataProperty getBody() { + @SuppressWarnings("unchecked") + public T getBody() { if (property == null) { try { - property = odataClient.getReader().readProperty( + final Container<Property> container = + odataClient.getDeserializer().toProperty( res.getEntity().getContent(), ODataFormat.fromString(getContentType())); + + property = (T) odataClient.getBinder().getODataProperty(extractFromContainer(container)); } catch (IOException e) { throw new HttpClientException(e); } finally { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java index 0212048c2..09f4c1485 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java @@ -31,6 +31,7 @@ import org.apache.olingo.commons.api.format.ODataPubFormat; import org.apache.olingo.client.api.http.HttpMethod; import org.apache.olingo.client.core.communication.request.ODataRequestImpl; import org.apache.olingo.client.core.communication.response.AbstractODataResponse; +import org.apache.olingo.commons.api.data.Container; /** * This class implements a generic OData request. @@ -92,10 +93,11 @@ public class ODataRawRequestImpl extends ODataRequestImpl<ODataPubFormat> this.close(); } } - - return odataClient.getReader().read(new ByteArrayInputStream(obj), getContentType(), reference); + + final Container<T> container = + odataClient.getReader().read(new ByteArrayInputStream(obj), getContentType(), reference); + + return extractFromContainer(container); } - } - } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java index 128e2504f..bf37a3225 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java @@ -24,6 +24,8 @@ import org.apache.http.client.HttpClient; import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; +import org.apache.olingo.client.api.data.ServiceDocument; +import org.apache.olingo.commons.api.data.Container; import org.apache.olingo.commons.api.domain.ODataServiceDocument; import org.apache.olingo.commons.api.format.ODataFormat; @@ -81,8 +83,10 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques public ODataServiceDocument getBody() { if (serviceDocument == null) { try { - serviceDocument = odataClient.getReader().readServiceDocument( + final Container<ServiceDocument> container = odataClient.getDeserializer().toServiceDocument( getRawResponse(), ODataFormat.fromString(getContentType())); + + serviceDocument = odataClient.getBinder().getODataServiceDocument(extractFromContainer(container)); } finally { this.close(); } 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 345bc5892..cd8ca18fb 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.client.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())). 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 3e07579cc..0e8db345b 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 @@ -18,13 +18,25 @@ */ package org.apache.olingo.client.core.communication.request.retrieve.v3; -import org.apache.olingo.client.core.communication.request.retrieve.v3.ODataLinkCollectionRequestImpl; 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; 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.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; +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 { @@ -34,8 +46,34 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory super(client); } + @Override + public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) { + return new XMLMetadataRequestImpl(((ODataClient) client), + client.getURIBuilder(serviceRoot).appendMetadataSegment().build()); + } + @Override public ODataLinkCollectionRequest getLinkCollectionRequest(final URI targetURI, final String linkName) { return new ODataLinkCollectionRequestImpl((ODataClient) client, targetURI, linkName); } + + @Override + public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI uri) { + return new ODataEntitySetRequestImpl<ODataEntitySet>(client, uri); + } + + @Override + public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(final URI uri) { + return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri); + } + + @Override + public ODataEntityRequest<ODataEntity> getEntityRequest(final URI uri) { + return new ODataEntityRequestImpl<ODataEntity>(client, uri); + } + + @Override + public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI uri) { + return new ODataPropertyRequestImpl<ODataProperty>(client, uri); + } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/XMLMetadataRequestImpl.java new file mode 100644 index 000000000..cf1be4147 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/XMLMetadataRequestImpl.java @@ -0,0 +1,79 @@ +/* + * 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.communication.request.retrieve.v3; + +import java.net.URI; +import java.util.List; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest; +import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; +import org.apache.olingo.client.api.edm.xml.Schema; +import org.apache.olingo.client.api.edm.xml.XMLMetadata; +import org.apache.olingo.client.api.v3.ODataClient; +import org.apache.olingo.client.core.communication.request.retrieve.AbstractMetadataRequestImpl; + +public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<List<? extends Schema>> + implements XMLMetadataRequest { + + XMLMetadataRequestImpl(final ODataClient odataClient, final URI query) { + super(odataClient, query); + } + + @Override + public ODataRetrieveResponse<List<? extends Schema>> execute() { + return new XMLMetadataResponseImpl(httpClient, doExecute()); + } + + public class XMLMetadataResponseImpl extends ODataRetrieveResponseImpl { + + private XMLMetadata metadata = null; + + /** + * Constructor. + * <br/> + * Just to create response templates to be initialized from batch. + */ + private XMLMetadataResponseImpl() { + super(); + } + + /** + * Constructor. + * + * @param client HTTP client. + * @param res HTTP response. + */ + private XMLMetadataResponseImpl(final HttpClient client, final HttpResponse res) { + super(client, res); + } + + @Override + public List<? extends Schema> getBody() { + if (metadata == null) { + try { + metadata = odataClient.getDeserializer().toMetadata(getRawResponse()); + } finally { + this.close(); + } + } + return metadata.getSchemas(); + } + } +} 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 016320f3e..879417bfb 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,24 @@ */ package org.apache.olingo.client.core.communication.request.retrieve.v4; -import org.apache.olingo.client.api.v4.ODataClient; +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; 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.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; +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 { @@ -30,4 +44,30 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory public RetrieveRequestFactoryImpl(final ODataClient client) { super(client); } + + @Override + public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) { + return new XMLMetadataRequestImpl(((ODataClient) client), + client.getURIBuilder(serviceRoot).appendMetadataSegment().build()); + } + + @Override + public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI uri) { + return new ODataEntitySetRequestImpl<ODataEntitySet>(client, uri); + } + + @Override + public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(final URI uri) { + return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri); + } + + @Override + public ODataEntityRequest<ODataEntity> getEntityRequest(final URI uri) { + return new ODataEntityRequestImpl<ODataEntity>(client, uri); + } + + @Override + public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI uri) { + return new ODataPropertyRequestImpl<ODataProperty>(client, uri); + } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java new file mode 100644 index 000000000..db141ebf2 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java @@ -0,0 +1,122 @@ +/* + * 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.communication.request.retrieve.v4; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest; +import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; +import org.apache.olingo.client.api.edm.xml.Schema; +import org.apache.olingo.client.api.edm.xml.v4.Include; +import org.apache.olingo.client.api.edm.xml.v4.Reference; +import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata; +import org.apache.olingo.client.api.v4.ODataClient; +import org.apache.olingo.client.core.communication.request.retrieve.AbstractMetadataRequestImpl; + +public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<List<? extends Schema>> + implements XMLMetadataRequest { + + XMLMetadataRequestImpl(final ODataClient odataClient, final URI uri) { + super(odataClient, uri); + } + + @Override + public ODataRetrieveResponse<List<? extends Schema>> execute() { + final SingleXMLMetadatRequestImpl rootReq = new SingleXMLMetadatRequestImpl((ODataClient) odataClient, uri); + final ODataRetrieveResponse<XMLMetadata> rootRes = rootReq.execute(); + + final XMLMetadataResponseImpl response = new XMLMetadataResponseImpl(); + + final XMLMetadata rootMetadata = rootRes.getBody(); + response.getSchemas().addAll(rootMetadata.getSchemas()); + + if (!rootMetadata.getReferences().isEmpty()) { + for (Reference reference : rootMetadata.getReferences()) { + final SingleXMLMetadatRequestImpl includeReq = new SingleXMLMetadatRequestImpl((ODataClient) odataClient, + odataClient.getURIBuilder(reference.getUri().toASCIIString()).appendMetadataSegment().build()); + final XMLMetadata includeMetadata = includeReq.execute().getBody(); + + for (Include include : reference.getIncludes()) { + Schema includedSchema = includeMetadata.getSchema(include.getNamespace()); + if (includedSchema == null && StringUtils.isNotBlank(include.getAlias())) { + includedSchema = includeMetadata.getSchema(include.getAlias()); + } + if (includedSchema != null) { + response.getSchemas().add(includedSchema); + } + } + } + } + + return response; + } + + private class SingleXMLMetadatRequestImpl extends AbstractMetadataRequestImpl<XMLMetadata> { + + public SingleXMLMetadatRequestImpl(final ODataClient odataClient, final URI uri) { + super(odataClient, uri); + } + + @Override + public ODataRetrieveResponse<XMLMetadata> execute() { + return new ODataRetrieveResponseImpl(httpClient, doExecute()) { + + @Override + public XMLMetadata getBody() { + try { + return ((ODataClient) odataClient).getDeserializer().toMetadata(getRawResponse()); + } finally { + this.close(); + } + } + }; + } + } + + public class XMLMetadataResponseImpl extends ODataRetrieveResponseImpl { + + private final List<Schema> schemas = new ArrayList<Schema>(); + + /** + * Constructor. + * <br/> + * Just to create response templates to be initialized from batch. + */ + private XMLMetadataResponseImpl() { + super(); + } + + @Override + public void close() { + // just do nothing, this is a placeholder response + } + + public List<Schema> getSchemas() { + return schemas; + } + + @Override + public List<? extends Schema> getBody() { + return getSchemas(); + } + } + +} 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 f8487bc75..2c1dd22e4 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,10 +28,12 @@ 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; +import org.apache.olingo.commons.api.data.Container; +import org.apache.olingo.commons.api.data.Entry; /** * This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory. @@ -96,7 +98,7 @@ public class ODataMediaEntityCreateRequestImpl private class ODataMediaEntityCreateResponseImpl extends AbstractODataResponse implements ODataMediaEntityCreateResponse { - private ODataEntity entity = null; + private CommonODataEntity entity = null; /** * Constructor. @@ -120,10 +122,11 @@ public class ODataMediaEntityCreateRequestImpl * {@inheritDoc } */ @Override - public ODataEntity getBody() { + public CommonODataEntity getBody() { if (entity == null) { try { - entity = odataClient.getReader().readEntity(getRawResponse(), getFormat()); + final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat()); + entity = odataClient.getBinder().getODataEntity(extractFromContainer(container)); } finally { this.close(); } 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 4f0edce86..614baa1c6 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,10 +28,12 @@ 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; +import org.apache.olingo.commons.api.data.Container; +import org.apache.olingo.commons.api.data.Entry; /** * This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory. @@ -99,7 +101,7 @@ public class ODataMediaEntityUpdateRequestImpl private class ODataMediaEntityUpdateResponseImpl extends AbstractODataResponse implements ODataMediaEntityUpdateResponse { - private ODataEntity entity = null; + private CommonODataEntity entity = null; /** * Constructor. @@ -123,10 +125,11 @@ public class ODataMediaEntityUpdateRequestImpl * {@inheritDoc } */ @Override - public ODataEntity getBody() { + public CommonODataEntity getBody() { if (entity == null) { try { - entity = odataClient.getReader().readEntity(getRawResponse(), getFormat()); + final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat()); + entity = odataClient.getBinder().getODataEntity(extractFromContainer(container)); } finally { this.close(); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java index 7b2790613..c571cd60f 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.PipedInputStream; import java.io.PipedOutputStream; +import java.net.URI; import java.util.Collection; import java.util.HashSet; import java.util.Map; @@ -37,6 +38,7 @@ import org.apache.olingo.client.api.communication.response.ODataResponse; import org.apache.olingo.client.api.http.NoContentException; import org.apache.olingo.client.core.communication.request.batch.ODataBatchController; import org.apache.olingo.client.core.communication.request.batch.ODataBatchUtilities; +import org.apache.olingo.commons.api.data.Container; import org.slf4j.LoggerFactory; /** @@ -49,6 +51,16 @@ public abstract class AbstractODataResponse implements ODataResponse { */ protected static final org.slf4j.Logger LOG = LoggerFactory.getLogger(ODataResponse.class); + /** + * Context URL. + */ + private URI contextURL; + + /** + * Metadata ETag. + */ + private String metadataETag; + /** * HTTP client. */ @@ -133,6 +145,24 @@ public abstract class AbstractODataResponse implements ODataResponse { statusMessage = res.getStatusLine().getReasonPhrase(); } + @Override + public URI getContextURL() { + return contextURL; + } + + protected void setContextURL(final URI contextURL) { + this.contextURL = contextURL; + } + + @Override + public String getMetadataETag() { + return metadataETag; + } + + protected void setMetadataETag(final String metadataETag) { + this.metadataETag = metadataETag; + } + /** * {@inheritDoc} */ @@ -273,4 +303,14 @@ public abstract class AbstractODataResponse implements ODataResponse { return payload; } + + protected <T> T extractFromContainer(final Container<T> container) { + if (container == null) { + return null; + } + + setContextURL(container.getContextURL()); + setMetadataETag(container.getMetadataETag()); + return container.getObject(); + } } 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 57ba0efd7..83b3a1286 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>(); - @Override - public String getMetadataContext() { - return null; - } + private String metadata; @Override - public String getMetadataETag() { - 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; + } + + /** + * 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 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 143aed88d..f949e16ab 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,20 +47,29 @@ 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_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_METADATA_ETAG)) { + metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue(); + tree.remove(Constants.JSON_METADATA_ETAG); + } else { + metadataETag = null; } - for (final Iterator<JsonNode> itor = tree.get(Constants.JSON_VALUE).elements(); itor.hasNext();) { + 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(); final ServiceDocumentItemImpl item = new ServiceDocumentItemImpl(); @@ -79,7 +91,6 @@ public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Ab } } - return serviceDocument; + return new Container<AbstractServiceDocument>(contextURL, metadataETag, serviceDocument); } - } 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 ef62f1363..1b1804048 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); + } } 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 ace54876a..af957a1fe 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; - } } 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 682f500f4..e09b092e1 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; - } - } 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 47f294f8a..45ce766ba 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,50 +26,12 @@ 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>(); 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; } - } 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 b5c352be2..f3dfd9131 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; - } - } 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 2885658be..b3c64b64a 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 { - } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java deleted file mode 100644 index daa63a3a8..000000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java +++ /dev/null @@ -1,130 +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.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.olingo.commons.api.domain.AbstractODataValue; -import org.apache.olingo.commons.api.domain.ODataGeospatialValue; -import org.apache.olingo.commons.api.edm.EdmGeospatialType; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.apache.olingo.commons.api.edm.geo.Geospatial; -import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; - -public class ODataGeospatialValueImpl extends AbstractODataValue implements ODataGeospatialValue { - - private static final long serialVersionUID = 8277433906326348952L; - - public static class BuilderImpl implements Builder { - - private final ODataGeospatialValueImpl instance; - - public BuilderImpl() { - this.instance = new ODataGeospatialValueImpl(); - } - - @Override - public BuilderImpl setType(final EdmPrimitiveTypeKind type) { - if (type != null && !type.isGeospatial()) { - throw new IllegalArgumentException("Don't use this for non-geospatial types"); - } - 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."); - } - - if (type != null) { - this.instance.typeKind = type; - this.instance.type = EdmPrimitiveTypeFactory.getGeoInstance(type); - } - - return this; - } - - @Override - public BuilderImpl setValue(final Geospatial value) { - this.instance.value = value; - if (value != null) { - setType(value.getEdmPrimitiveTypeKind()); - } - return this; - } - - @Override - public ODataGeospatialValueImpl build() { - if (this.instance.type == null) { - throw new IllegalArgumentException("Must provide geospatial type"); - } - if (this.instance.value == null) { - throw new IllegalArgumentException("Must provide geospatial value"); - } - - return this.instance; - } - } - - /** - * Type kind. - */ - private EdmPrimitiveTypeKind typeKind; - - /** - * Type. - */ - private EdmGeospatialType type; - - /** - * Value. - */ - private Geospatial value; - - @Override - public EdmPrimitiveTypeKind getTypeKind() { - return typeKind; - } - - @Override - public EdmGeospatialType getType() { - return type; - } - - @Override - public Geospatial toValue() { - return value; - } - - @Override - public <T extends Geospatial> T toCastValue(final Class<T> reference) { - return reference.cast(this.value); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public boolean equals(final Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - -} 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 65082244b..12463d376 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 @@ -29,16 +29,16 @@ import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.olingo.client.api.edm.xml.EntityContainer; import org.apache.olingo.client.api.edm.xml.EntitySet; import org.apache.olingo.client.api.edm.xml.Schema; -import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.commons.api.edm.EdmActionImportInfo; import org.apache.olingo.commons.api.edm.EdmEntitySetInfo; import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo; import org.apache.olingo.commons.api.edm.EdmServiceMetadata; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.core.edm.EdmEntitySetInfoImpl; public abstract class AbstractEdmServiceMetadataImpl implements EdmServiceMetadata { - protected final XMLMetadata xmlMetadata; + protected final List<? extends Schema> xmlSchemas; private List<EdmEntitySetInfo> entitySetInfos; @@ -46,17 +46,16 @@ public abstract class AbstractEdmServiceMetadataImpl implements EdmServiceMetada protected List<EdmActionImportInfo> actionImportInfos; - public static EdmServiceMetadata getInstance(final XMLMetadata xmlMetadata) { - return xmlMetadata instanceof org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl - ? new org.apache.olingo.client.core.edm.v3.EdmServiceMetadataImpl( - (org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl) xmlMetadata) - : new org.apache.olingo.client.core.edm.v4.EdmServiceMetadataImpl( - (org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl) xmlMetadata); + public static EdmServiceMetadata getInstance(final ODataServiceVersion version, + final List<? extends Schema> xmlSchemas) { + return version == ODataServiceVersion.V30 + ? new org.apache.olingo.client.core.edm.v3.EdmServiceMetadataImpl(xmlSchemas) + : new org.apache.olingo.client.core.edm.v4.EdmServiceMetadataImpl(xmlSchemas); } - public AbstractEdmServiceMetadataImpl(final XMLMetadata xmlMetadata) { - this.xmlMetadata = xmlMetadata; + public AbstractEdmServiceMetadataImpl(final List<? extends Schema> xmlSchemas) { + this.xmlSchemas = xmlSchemas; } @Override @@ -69,11 +68,10 @@ public abstract class AbstractEdmServiceMetadataImpl implements EdmServiceMetada synchronized (this) { if (entitySetInfos == null) { entitySetInfos = new ArrayList<EdmEntitySetInfo>(); - for (Schema schema : xmlMetadata.getSchemas()) { + for (Schema schema : xmlSchemas) { for (EntityContainer entityContainer : schema.getEntityContainers()) { for (EntitySet entitySet : entityContainer.getEntitySets()) { - entitySetInfos.add( - new EdmEntitySetInfoImpl(entityContainer.getName(), entitySet.getName())); + entitySetInfos.add(new EdmEntitySetInfoImpl(entityContainer.getName(), entitySet.getName())); } } } 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 6f1990e01..452c880f7 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; + } + } 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 573e2bc0b..c2c832d5d 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 @@ -39,7 +39,6 @@ import org.apache.olingo.client.api.edm.xml.EntityContainer; import org.apache.olingo.client.api.edm.xml.EntityType; import org.apache.olingo.client.api.edm.xml.EnumType; import org.apache.olingo.client.api.edm.xml.Schema; -import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.api.edm.xml.v3.FunctionImport; import org.apache.olingo.client.api.edm.xml.v4.Action; import org.apache.olingo.client.api.edm.xml.v4.Function; @@ -64,18 +63,23 @@ public class EdmClientImpl extends AbstractEdmImpl { private final ODataServiceVersion version; - private final XMLMetadata xmlMetadata; + private final List<? extends Schema> xmlSchemas; + + private final Map<String, Schema> xmlSchemaByNamespace; private final EdmServiceMetadata serviceMetadata; - public EdmClientImpl(final ODataServiceVersion version, final XMLMetadata xmlMetadata) { + public EdmClientImpl(final ODataServiceVersion version, final List<? extends Schema> xmlSchemas) { this.version = version; - this.xmlMetadata = xmlMetadata; - this.serviceMetadata = AbstractEdmServiceMetadataImpl.getInstance(xmlMetadata); - } - public XMLMetadata getXMLMetadata() { - return xmlMetadata; + this.xmlSchemas = xmlSchemas; + + this.xmlSchemaByNamespace = new HashMap<String, Schema>(); + for (Schema schema : xmlSchemas) { + xmlSchemaByNamespace.put(schema.getNamespace(), schema); + } + + this.serviceMetadata = AbstractEdmServiceMetadataImpl.getInstance(version, xmlSchemas); } @Override @@ -87,7 +91,7 @@ public class EdmClientImpl extends AbstractEdmImpl { protected Map<String, String> createAliasToNamespaceInfo() { final Map<String, String> aliasToNamespace = new HashMap<String, String>(); - for (Schema schema : xmlMetadata.getSchemas()) { + for (Schema schema : xmlSchemas) { aliasToNamespace.put(null, schema.getNamespace()); if (StringUtils.isNotBlank(schema.getAlias())) { aliasToNamespace.put(schema.getAlias(), schema.getNamespace()); @@ -101,11 +105,11 @@ public class EdmClientImpl extends AbstractEdmImpl { protected EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) { EdmEntityContainer result = null; - final Schema schema = xmlMetadata.getSchema(containerName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(containerName.getNamespace()); if (schema != null) { final EntityContainer xmlEntityContainer = schema.getDefaultEntityContainer(); if (xmlEntityContainer != null) { - result = new EdmEntityContainerImpl(this, containerName, xmlEntityContainer, xmlMetadata); + result = new EdmEntityContainerImpl(this, containerName, xmlEntityContainer, xmlSchemas); } } @@ -116,7 +120,7 @@ public class EdmClientImpl extends AbstractEdmImpl { protected EdmEnumType createEnumType(final FullQualifiedName enumName) { EdmEnumType result = null; - final Schema schema = xmlMetadata.getSchema(enumName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(enumName.getNamespace()); if (schema != null) { final EnumType xmlEnumType = schema.getEnumType(enumName.getName()); if (xmlEnumType != null) { @@ -131,7 +135,7 @@ public class EdmClientImpl extends AbstractEdmImpl { protected EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) { EdmTypeDefinition result = null; - final Schema schema = xmlMetadata.getSchema(typeDefinitionName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(typeDefinitionName.getNamespace()); if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) { final TypeDefinition xmlTypeDefinition = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema). getTypeDefinition(typeDefinitionName.getName()); @@ -149,7 +153,7 @@ public class EdmClientImpl extends AbstractEdmImpl { protected EdmEntityType createEntityType(final FullQualifiedName entityTypeName) { EdmEntityType result = null; - final Schema schema = xmlMetadata.getSchema(entityTypeName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(entityTypeName.getNamespace()); final EntityType xmlEntityType = schema.getEntityType(entityTypeName.getName()); if (xmlEntityType != null) { result = EdmEntityTypeImpl.getInstance(this, entityTypeName, xmlEntityType); @@ -162,7 +166,7 @@ public class EdmClientImpl extends AbstractEdmImpl { protected EdmComplexType createComplexType(final FullQualifiedName complexTypeName) { EdmComplexType result = null; - final Schema schema = xmlMetadata.getSchema(complexTypeName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(complexTypeName.getNamespace()); final ComplexType xmlComplexType = schema.getComplexType(complexTypeName.getName()); if (xmlComplexType != null) { result = EdmComplexTypeImpl.getInstance(this, complexTypeName, xmlComplexType); @@ -175,7 +179,7 @@ public class EdmClientImpl extends AbstractEdmImpl { protected EdmAction createUnboundAction(final FullQualifiedName actionName) { EdmAction result = null; - final Schema schema = xmlMetadata.getSchema(actionName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(actionName.getNamespace()); if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) { final List<Action> actions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema). getActions(actionName.getName()); @@ -210,7 +214,7 @@ public class EdmClientImpl extends AbstractEdmImpl { protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) { EdmFunction result = null; - final Schema schema = xmlMetadata.getSchema(functionName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace()); if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) { final List<Function> functions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema). getFunctions(functionName.getName()); @@ -259,7 +263,7 @@ public class EdmClientImpl extends AbstractEdmImpl { EdmAction result = null; - final Schema schema = xmlMetadata.getSchema(actionName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(actionName.getNamespace()); if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) { final List<Action> actions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema). getActions(actionName.getName()); @@ -309,7 +313,7 @@ public class EdmClientImpl extends AbstractEdmImpl { EdmFunction result = null; - final Schema schema = xmlMetadata.getSchema(functionName.getNamespace()); + final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace()); if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) { final List<Function> functions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema). getFunctions(functionName.getName()); @@ -382,8 +386,8 @@ public class EdmClientImpl extends AbstractEdmImpl { @Override protected List<EdmSchema> createSchemas() { final List<EdmSchema> schemas = new ArrayList<EdmSchema>(); - for (Schema schema : xmlMetadata.getSchemas()) { - schemas.add(new EdmSchemaImpl(version, this, xmlMetadata, schema)); + for (Schema schema : xmlSchemas) { + schemas.add(new EdmSchemaImpl(version, this, xmlSchemas, schema)); } return schemas; } 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 635b752e7..e73d3be5d 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 @@ -25,7 +25,7 @@ import org.apache.olingo.client.api.v3.UnsupportedInV3Exception; import org.apache.olingo.client.api.edm.xml.CommonFunctionImport; import org.apache.olingo.client.api.edm.xml.EntityContainer; import org.apache.olingo.client.api.edm.xml.EntitySet; -import org.apache.olingo.client.api.edm.xml.XMLMetadata; +import org.apache.olingo.client.api.edm.xml.Schema; import org.apache.olingo.client.api.edm.xml.v3.FunctionImport; import org.apache.olingo.client.api.edm.xml.v4.ActionImport; import org.apache.olingo.client.api.edm.xml.v4.Singleton; @@ -45,15 +45,22 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { 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 @@ -63,13 +70,13 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { } final Singleton singleton = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer). - getSingleton(singletonName); + getSingleton(singletonName); if (singleton == null) { throw new EdmException("Singleton named '" + singletonName + "' not found in " + entityContainerName); } return new EdmSingletonImpl(edm, this, singletonName, new EdmTypeInfo.Builder(). - setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()). - build().getFullQualifiedName(), singleton); + setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()). + build().getFullQualifiedName(), singleton); } @Override @@ -80,12 +87,12 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { } final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()). - setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName(); + setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName(); if (entitySet instanceof org.apache.olingo.client.api.edm.xml.v4.EntitySet) { return new EdmEntitySetImpl(edm, this, entitySetName, entityType, - (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet); + (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet); } else { - return new EdmEntitySetProxy(edm, this, entitySetName, entityType, xmlMetadata); + return new EdmEntitySetProxy(edm, this, entitySetName, entityType, xmlSchemas); } } @@ -93,7 +100,7 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { protected EdmActionImport createActionImport(final String actionImportName) { if (xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer) { final ActionImport actionImport = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer). - getActionImport(actionImportName); + getActionImport(actionImportName); if (actionImport == null) { throw new EdmException("ActionImport named '" + actionImportName + "' not found in " + entityContainerName); } @@ -116,10 +123,10 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) { return new EdmFunctionImportImpl(edm, this, functionImportName, - (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport); + (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport); } else { return new EdmFunctionImportProxy(edm, this, functionImportName, - (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport); + (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport); } } @@ -130,13 +137,13 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { for (EntitySet entitySet : localEntitySets) { EdmEntitySet edmSet; final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()). - setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName(); + setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName(); if (entitySet instanceof org.apache.olingo.client.api.edm.xml.v4.EntitySet) { edmSet = - new EdmEntitySetImpl(edm, this, entitySet.getName(), entityType, - (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet); + new EdmEntitySetImpl(edm, this, entitySet.getName(), entityType, + (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet); } else { - edmSet = new EdmEntitySetProxy(edm, this, entitySet.getName(), entityType, xmlMetadata); + edmSet = new EdmEntitySetProxy(edm, this, entitySet.getName(), entityType, xmlSchemas); } entitySets.put(edmSet.getName(), edmSet); } @@ -152,10 +159,10 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { EdmFunctionImport edmFunctionImport; if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) { edmFunctionImport = new EdmFunctionImportImpl(edm, this, functionImport.getName(), - (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport); + (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport); } else { edmFunctionImport = new EdmFunctionImportProxy(edm, this, functionImport.getName(), - (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport); + (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport); } functionImports.put(edmFunctionImport.getName(), edmFunctionImport); } @@ -169,11 +176,11 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { } final List<Singleton> localSingletons = - ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).getSingletons(); + ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).getSingletons(); if (localSingletons != null) { for (Singleton singleton : localSingletons) { singletons.put(singleton.getName(), new EdmSingletonImpl(edm, this, singleton.getName(), - new EdmTypeInfo.Builder(). + new EdmTypeInfo.Builder(). setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()). build().getFullQualifiedName(), singleton)); } @@ -184,11 +191,11 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { protected void loadAllActionImports() { if (xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer) { final List<ActionImport> localActionImports = - ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).getActionImports(); + ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).getActionImports(); if (actionImports != null) { for (ActionImport actionImport : localActionImports) { actionImports.put(actionImport.getName(), - new EdmActionImportImpl(edm, this, actionImport.getName(), actionImport)); + new EdmActionImportImpl(edm, this, actionImport.getName(), actionImport)); } } } else { @@ -197,7 +204,7 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { if (localFunctionImports != null) { for (FunctionImport functionImport : localFunctionImports) { actionImports.put(functionImport.getName(), - new EdmActionImportProxy(edm, this, functionImport.getName(), functionImport)); + new EdmActionImportProxy(edm, this, functionImport.getName(), functionImport)); } } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java index 05cfa27be..bba016b1e 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java @@ -62,9 +62,9 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType super(edm, fqn, xmlEnumType.isFlags()); if (xmlEnumType.getUnderlyingType() == null) { - this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32); + this.underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32); } else { - this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance( + this.underlyingType = EdmPrimitiveTypeFactory.getInstance( EdmPrimitiveTypeKind.valueOfFQN(version, xmlEnumType.getUnderlyingType())); if (!ArrayUtils.contains(VALID_UNDERLYING_TYPES, this.underlyingType.getKind())) { throw new EdmException("Not allowed as underlying type: " + this.underlyingType.getKind()); 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 44e723e3a..c2a38c472 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,37 +1,41 @@ /* * 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 org.apache.olingo.commons.core.edm.EdmTypeInfo; +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; +import org.apache.olingo.commons.core.edm.EdmTypeInfo; 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()); @@ -72,4 +76,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; + } + } 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 ffe41cde4..2989a86c3 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 @@ -26,7 +26,6 @@ import org.apache.olingo.client.api.edm.xml.EntityContainer; import org.apache.olingo.client.api.edm.xml.EntityType; import org.apache.olingo.client.api.edm.xml.EnumType; import org.apache.olingo.client.api.edm.xml.Schema; -import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.api.edm.xml.v3.FunctionImport; import org.apache.olingo.client.api.edm.xml.v4.Action; import org.apache.olingo.client.api.edm.xml.v4.Function; @@ -50,18 +49,18 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl { private final Edm edm; - private final XMLMetadata xmlMetadata; + private final List<? extends Schema> xmlSchemas; private final Schema schema; public EdmSchemaImpl(final ODataServiceVersion version, final Edm edm, - final XMLMetadata xmlMetadata, final Schema schema) { + final List<? extends Schema> xmlSchemas, final Schema schema) { super(schema.getNamespace(), schema.getAlias()); this.version = version; this.edm = edm; - this.xmlMetadata = xmlMetadata; + this.xmlSchemas = xmlSchemas; this.schema = schema; } @@ -71,7 +70,7 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl { if (defaultContainer != null) { final FullQualifiedName entityContainerName = new FullQualifiedName(schema.getNamespace(), defaultContainer.getName()); - return new EdmEntityContainerImpl(edm, entityContainerName, defaultContainer, xmlMetadata); + return new EdmEntityContainerImpl(edm, entityContainerName, defaultContainer, xmlSchemas); } return null; } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java index 199d61e72..3c146ecbf 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java @@ -41,7 +41,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements super(edm, typeDefinitionName); this.typeDefinition = typeDefinition; try { - this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance( + this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance( EdmPrimitiveTypeKind.valueOfFQN(version, typeDefinition.getUnderlyingType())); } catch (IllegalArgumentException e) { throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e); 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 0cc0ff863..1303fefa0 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 @@ -23,7 +23,6 @@ import java.util.List; import org.apache.olingo.client.api.edm.xml.EntityContainer; import org.apache.olingo.client.api.edm.xml.Schema; -import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.api.edm.xml.v3.Association; import org.apache.olingo.client.api.edm.xml.v3.AssociationSet; import org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl; @@ -33,24 +32,25 @@ 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; public class EdmEntitySetProxy extends AbstractEdmBindingTarget implements EdmEntitySet { - private final XMLMetadata xmlMetadata; + private final List<? extends Schema> xmlSchemas; public EdmEntitySetProxy(final Edm edm, final EdmEntityContainer container, final String name, - final FullQualifiedName type, final XMLMetadata xmlMetadata) { + final FullQualifiedName type, final List<? extends Schema> xmlSchemas) { super(edm, container, name, type); - this.xmlMetadata = xmlMetadata; + this.xmlSchemas = xmlSchemas; } @Override public EdmBindingTarget getRelatedBindingTarget(final String path) { final List<AssociationSet> candidateAssociationSets = new ArrayList<AssociationSet>(); - for (Schema schema : xmlMetadata.getSchemas()) { + for (Schema schema : xmlSchemas) { for (EntityContainer _entityContainer : schema.getEntityContainers()) { final EntityContainerImpl entityContainer = (EntityContainerImpl) _entityContainer; for (AssociationSet associationSet : entityContainer.getAssociationSets()) { @@ -69,7 +69,7 @@ public class EdmEntitySetProxy extends AbstractEdmBindingTarget implements EdmEn Schema targetSchema = null; String targetEntitySet = null; for (AssociationSet associationSet : candidateAssociationSets) { - for (Schema schema : xmlMetadata.getSchemas()) { + for (Schema schema : xmlSchemas) { for (Association association : ((SchemaImpl) schema).getAssociations()) { final FullQualifiedName associationName = new FullQualifiedName(schema.getNamespace(), association.getName()); if (associationName.getFullQualifiedNameAsString().equals(associationSet.getAssociation()) @@ -105,4 +105,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>(); + } + } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java index d1f539342..9b7157b37 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java @@ -27,7 +27,6 @@ import org.apache.olingo.client.api.edm.xml.EntityContainer; import org.apache.olingo.client.api.edm.xml.Schema; import org.apache.olingo.client.api.edm.xml.v3.FunctionImport; import org.apache.olingo.client.core.edm.AbstractEdmServiceMetadataImpl; -import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl; import org.apache.olingo.commons.api.edm.EdmActionImportInfo; import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo; import org.apache.olingo.commons.api.edm.EdmSingletonInfo; @@ -39,8 +38,8 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl { private static final ODataServiceVersion SERVICE_VERSION = ODataServiceVersion.V30; - public EdmServiceMetadataImpl(final XMLMetadataImpl xmlMetadata) { - super(xmlMetadata); + public EdmServiceMetadataImpl(final List<? extends Schema> xmlSchemas) { + super(xmlSchemas); } @Override @@ -58,7 +57,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl { synchronized (this) { if (functionImportInfos == null) { functionImportInfos = new ArrayList<EdmFunctionImportInfo>(); - for (Schema schema : xmlMetadata.getSchemas()) { + for (Schema schema : xmlSchemas) { for (EntityContainer entityContainer : schema.getEntityContainers()) { for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) { final FunctionImport _funFunctionImport = (FunctionImport) functionImport; @@ -79,7 +78,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl { synchronized (this) { if (actionImportInfos == null) { actionImportInfos = new ArrayList<EdmActionImportInfo>(); - for (Schema schema : xmlMetadata.getSchemas()) { + for (Schema schema : xmlSchemas) { for (EntityContainer entityContainer : schema.getEntityContainers()) { for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) { final FunctionImport _funFunctionImport = (FunctionImport) functionImport; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java index 55cecc743..25236bea9 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java @@ -22,12 +22,11 @@ import java.util.ArrayList; import java.util.List; import org.apache.olingo.client.api.edm.xml.CommonFunctionImport; +import org.apache.olingo.client.api.edm.xml.Schema; import org.apache.olingo.client.api.edm.xml.v4.ActionImport; import org.apache.olingo.client.api.edm.xml.v4.EntityContainer; -import org.apache.olingo.client.api.edm.xml.v4.Schema; import org.apache.olingo.client.api.edm.xml.v4.Singleton; import org.apache.olingo.client.core.edm.AbstractEdmServiceMetadataImpl; -import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl; import org.apache.olingo.commons.api.edm.EdmActionImportInfo; import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo; import org.apache.olingo.commons.api.edm.EdmSingletonInfo; @@ -44,8 +43,8 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl { private List<EdmActionImportInfo> actionImportInfos; - public EdmServiceMetadataImpl(final XMLMetadataImpl xmlMetadata) { - super(xmlMetadata); + public EdmServiceMetadataImpl(final List<? extends Schema> xmlSchemas) { + super(xmlSchemas); } @Override @@ -58,7 +57,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl { synchronized (this) { if (singletonInfos == null) { singletonInfos = new ArrayList<EdmSingletonInfo>(); - for (Schema schema : ((XMLMetadataImpl) xmlMetadata).getSchemas()) { + for (Schema schema : xmlSchemas) { final EntityContainer entityContainer = (EntityContainer) schema.getDefaultEntityContainer(); for (Singleton singleton : entityContainer.getSingletons()) { singletonInfos.add(new EdmSingletonInfoImpl(entityContainer.getName(), singleton.getName())); @@ -74,16 +73,17 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl { synchronized (this) { if (functionImportInfos == null) { functionImportInfos = new ArrayList<EdmFunctionImportInfo>(); - for (Schema schema : ((XMLMetadataImpl) xmlMetadata).getSchemas()) { - for (EntityContainer entityContainer : schema.getEntityContainers()) { - for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) { - functionImportInfos.add( - new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName())); - } + for (Schema schema : xmlSchemas) { + final EntityContainer entityContainer = (EntityContainer) schema.getDefaultEntityContainer(); + + for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) { + functionImportInfos.add( + new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName())); } } } } + return functionImportInfos; } @@ -92,7 +92,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl { synchronized (this) { if (actionImportInfos == null) { actionImportInfos = new ArrayList<EdmActionImportInfo>(); - for (Schema schema : ((XMLMetadataImpl) xmlMetadata).getSchemas()) { + for (Schema schema : xmlSchemas) { final EntityContainer entityContainer = (EntityContainer) schema.getDefaultEntityContainer(); for (ActionImport actionImport : entityContainer.getActionImports()) { actionImportInfos.add(new EdmActionImportInfoImpl(entityContainer.getName(), actionImport.getName())); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java index 41fea802c..336dc4114 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java @@ -50,6 +50,7 @@ public class XMLMetadataImpl extends AbstractXMLMetadata implements XMLMetadata return (Schema) super.getSchema(key); } + @Override public List<Reference> getReferences() { return ((Edmx) this.edmx).getReferences(); } 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 44e7ad485..c9b6b0eb6 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 @@ -18,33 +18,36 @@ */ package org.apache.olingo.client.core.op; -import org.apache.olingo.commons.core.op.ResourceFactory; import java.io.StringWriter; import java.net.URI; import java.util.Iterator; import org.apache.commons.lang3.StringUtils; import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.data.ServiceDocument; +import org.apache.olingo.client.api.data.ServiceDocumentItem; +import org.apache.olingo.client.api.op.CommonODataBinder; +import org.apache.olingo.client.core.uri.URIUtils; 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.Property; -import org.apache.olingo.client.api.data.ServiceDocument; -import org.apache.olingo.client.api.data.ServiceDocumentItem; 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.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; +import org.apache.olingo.commons.api.edm.geo.Geospatial; import org.apache.olingo.commons.api.format.ODataPubFormat; -import org.apache.olingo.client.api.op.CommonODataBinder; import org.apache.olingo.commons.core.data.CollectionValueImpl; import org.apache.olingo.commons.core.data.ComplexValueImpl; import org.apache.olingo.commons.core.data.GeospatialValueImpl; @@ -52,8 +55,8 @@ 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.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; +import org.apache.olingo.commons.core.edm.EdmTypeInfo; +import org.apache.olingo.commons.core.op.ResourceFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -87,31 +90,32 @@ public abstract class AbstractODataBinder implements CommonODataBinder { } @Override - public Feed getFeed(final ODataEntitySet feed, final Class<? extends Feed> reference) { - final Feed feedResource = ResourceFactory.newFeed(reference); + public Feed getFeed(final CommonODataEntitySet entitySet, final Class<? extends Feed> reference) { + final Feed feed = ResourceFactory.newFeed(reference); - feedResource.setCount(feed.getCount()); + feed.setCount(entitySet.getCount()); - final URI next = feed.getNext(); + final URI next = entitySet.getNext(); if (next != null) { - feedResource.setNext(next); + feed.setNext(next); } - for (ODataEntity entity : feed.getEntities()) { - feedResource.getEntries().add(getEntry(entity, ResourceFactory.entryClassForFeed(reference))); + for (CommonODataEntity entity : entitySet.getEntities()) { + feed.getEntries().add(getEntry(entity, ResourceFactory.entryClassForFeed(reference))); } - return feedResource; + return feed; } @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.setType(entity.getName()); // ------------------------------------------------------------- @@ -170,9 +174,10 @@ public abstract class AbstractODataBinder implements CommonODataBinder { if (entity.isMediaEntity()) { entry.setMediaContentSource(entity.getMediaContentSource()); entry.setMediaContentType(entity.getMediaContentType()); + entry.setMediaETag(entity.getMediaETag()); } - for (ODataProperty property : entity.getProperties()) { + for (CommonODataProperty property : entity.getProperties()) { entry.getProperties().add(getProperty(property, reference, setType)); } @@ -190,13 +195,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))); @@ -205,48 +210,27 @@ public abstract class AbstractODataBinder implements CommonODataBinder { return linkResource; } - @Override - public Property getProperty(final ODataProperty 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().getType()); - } else if (property.hasCollectionValue()) { - propertyResource.setType(property.getCollectionValue().getType()); - } - } - - 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) { valueResource = new NullValueImpl(); } else if (value.isPrimitive()) { - valueResource = new PrimitiveValueImpl(value.asPrimitive().toString()); - } else if (value.isGeospatial()) { - valueResource = new GeospatialValueImpl(value.asGeospatial().toValue()); + valueResource = value.asPrimitive().getTypeKind().isGeospatial() + ? 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<ODataProperty> 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)); } } @@ -255,12 +239,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); @@ -269,10 +255,10 @@ public abstract class AbstractODataBinder implements CommonODataBinder { } final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI; - + 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())); @@ -281,19 +267,19 @@ public abstract class AbstractODataBinder implements CommonODataBinder { } for (Entry entryResource : resource.getEntries()) { - entitySet.addEntity(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); @@ -303,19 +289,19 @@ 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())); + URIUtils.getURI(base, resource.getSelfLink().getHref())); if (StringUtils.isNotBlank(resource.getETag())) { entity.setETag(resource.getETag()); } - + if (resource.getEditLink() != null) { entity.setEditLink(URIUtils.getURI(base, resource.getEditLink().getHref())); } - + for (Link link : resource.getAssociationLinks()) { entity.addLink(client.getObjectFactory().newAssociationLink(link.getTitle(), base, link.getHref())); } @@ -325,18 +311,22 @@ 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())); - } else if (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()))); + 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()))); } } @@ -353,45 +343,48 @@ 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()) { - entity.getProperties().add(getODataProperty(property)); + add(entity, getODataProperty(property)); } return entity; } - @Override - public ODataProperty getODataProperty(final Property property) { - return new ODataProperty(property.getName(), getODataValue(property)); - } - - private ODataValue getODataValue(final Property resource) { + protected ODataValue getODataValue(final Property resource) { ODataValue value = null; - if (resource.getValue().isSimple()) { - value = client.getPrimitiveValueBuilder(). - setText(resource.getValue().asSimple().get()). - setType(resource.getType() == null - ? null - : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build(); + 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(typeInfo == null + ? null + : EdmPrimitiveTypeKind.valueOfFQN( + client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build(); } else if (resource.getValue().isGeospatial()) { - value = client.getGeospatialValueBuilder(). + 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()) - ? null - : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build(); + 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(); } else if (resource.getValue().isComplex()) { - value = new ODataComplexValue(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 = new ODataCollectionValue(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(); 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 55b0d5749..b7d29f77c 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 @@ -19,21 +19,29 @@ package org.apache.olingo.client.core.op; import java.io.InputStream; +import java.util.List; import org.apache.commons.io.IOUtils; 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.commons.api.domain.ODataProperty; +import org.apache.olingo.client.api.edm.xml.Schema; +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; +import org.apache.olingo.client.api.op.CommonODataReader; +import org.apache.olingo.client.core.edm.EdmClientImpl; +import org.apache.olingo.commons.api.data.Container; +import org.apache.olingo.commons.api.data.Entry; +import org.apache.olingo.commons.api.data.Feed; +import org.apache.olingo.commons.api.edm.Edm; 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 org.apache.olingo.client.api.op.CommonODataReader; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,19 +62,19 @@ public abstract class AbstractODataReader implements CommonODataReader { } @Override - public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) { - return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format)); + public Edm readMetadata(final InputStream input) { + return readMetadata(client.getDeserializer().toMetadata(input).getSchemas()); } @Override - public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) { - return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format)); + public Edm readMetadata(final List<? extends Schema> xmlSchemas) { + return new EdmClientImpl(client.getServiceVersion(), xmlSchemas); } @Override - public ODataProperty readProperty(final InputStream input, final ODataFormat format) { - final Property property = client.getDeserializer().toProperty(input, format); - return client.getBinder().getODataProperty(property); + public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) { + return client.getBinder().getODataServiceDocument( + client.getDeserializer().toServiceDocument(input, format).getObject()); } @Override @@ -76,30 +84,48 @@ public abstract class AbstractODataReader implements CommonODataReader { @Override @SuppressWarnings("unchecked") - public <T> T read(final InputStream src, final String format, final Class<T> reference) { - Object res; + public <T> Container<T> read(final InputStream src, final String format, final Class<T> reference) { + Container<T> res; try { if (ODataEntitySetIterator.class.isAssignableFrom(reference)) { - res = new ODataEntitySetIterator(client, src, ODataPubFormat.fromString(format)); - } else if (ODataEntitySet.class.isAssignableFrom(reference)) { - res = readEntitySet(src, ODataPubFormat.fromString(format)); - } else if (ODataEntity.class.isAssignableFrom(reference)) { - res = readEntity(src, ODataPubFormat.fromString(format)); - } else if (ODataProperty.class.isAssignableFrom(reference)) { - res = readProperty(src, ODataFormat.fromString(format)); + res = new Container<T>( + null, null, (T) new ODataEntitySetIterator(client, src, ODataPubFormat.fromString(format))); + } 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 (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 (CommonODataProperty.class.isAssignableFrom(reference)) { + final Container<Property> container = client.getDeserializer().toProperty(src, ODataFormat.fromString(format)); + res = new Container<T>( + container.getContextURL(), + container.getMetadataETag(), + (T) client.getBinder().getODataProperty(container.getObject())); } else if (ODataValue.class.isAssignableFrom(reference)) { - res = client.getPrimitiveValueBuilder(). + res = new Container<T>(null, null, (T) client.getObjectFactory().newPrimitiveValueBuilder(). setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream). setText(IOUtils.toString(src)). - build(); + build()); } else if (XMLMetadata.class.isAssignableFrom(reference)) { - res = readMetadata(src); + res = new Container<T>(null, null, (T) readMetadata(src)); } else if (ODataServiceDocument.class.isAssignableFrom(reference)) { - res = readServiceDocument(src, ODataFormat.fromString(format)); + final Container<ServiceDocument> container = + client.getDeserializer().toServiceDocument(src, ODataFormat.fromString(format)); + res = new Container<T>( + container.getContextURL(), + container.getMetadataETag(), + (T) client.getBinder().getODataServiceDocument(container.getObject())); } else if (ODataError.class.isAssignableFrom(reference)) { - res = readError(src, !format.toString().contains("json")); + res = new Container<T>(null, null, (T) readError(src, !format.toString().contains("json"))); } else { throw new IllegalArgumentException("Invalid reference type " + reference); } @@ -112,6 +138,6 @@ public abstract class AbstractODataReader implements CommonODataReader { } } - return (T) res; + return res; } } 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 2b914b4ae..7ea9c99b1 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( 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 3c5f5a45c..50deadd8b 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,23 @@ */ 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; +import org.apache.olingo.commons.core.op.ResourceFactory; public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder { @@ -32,6 +44,62 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder super(client); } + @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 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); + } + + @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()); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java index d6b05d9a9..01bacbe01 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java @@ -21,6 +21,7 @@ package org.apache.olingo.client.core.op.impl.v3; import java.io.InputStream; import org.apache.olingo.client.api.data.ServiceDocument; +import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.commons.api.data.v3.LinkCollection; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.client.api.op.v3.ODataDeserializer; @@ -30,6 +31,7 @@ import org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl; import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl; import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl; import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl; +import org.apache.olingo.commons.api.data.Container; import org.apache.olingo.commons.core.op.AbstractODataDeserializer; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; @@ -42,7 +44,7 @@ public class ODataDeserializerImpl extends AbstractODataDeserializer implements } @Override - public XMLMetadataImpl toMetadata(final InputStream input) { + public XMLMetadata toMetadata(final InputStream input) { try { return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class)); } catch (Exception e) { @@ -51,17 +53,16 @@ public class ODataDeserializerImpl extends AbstractODataDeserializer implements } @Override - public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) { + public Container<ServiceDocument> toServiceDocument(final InputStream input, final ODataFormat format) { return format == ODataFormat.XML - ? xml(input, XMLServiceDocumentImpl.class) - : json(input, JSONServiceDocumentImpl.class); + ? this.<ServiceDocument, XMLServiceDocumentImpl>xml(input, XMLServiceDocumentImpl.class) + : this.<ServiceDocument, JSONServiceDocumentImpl>json(input, JSONServiceDocumentImpl.class); } @Override - public LinkCollection toLinkCollection(final InputStream input, final ODataFormat format) { + public Container<LinkCollection> toLinkCollection(final InputStream input, final ODataFormat format) { return format == ODataFormat.XML - ? atom(input, XMLLinkCollectionImpl.class) - : json(input, JSONLinkCollectionImpl.class); + ? this.<LinkCollection, XMLLinkCollectionImpl>atom(input, XMLLinkCollectionImpl.class) + : this.<LinkCollection, JSONLinkCollectionImpl>json(input, JSONLinkCollectionImpl.class); } - } 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 2c5a7d17e..8663e79b8 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 @@ -20,15 +20,18 @@ package org.apache.olingo.client.core.op.impl.v3; import java.io.InputStream; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; import org.apache.olingo.client.api.domain.v3.ODataLinkCollection; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.client.api.op.v3.ODataReader; import org.apache.olingo.client.api.v3.ODataClient; -import org.apache.olingo.client.core.v3.ODataClientImpl; -import org.apache.olingo.client.core.edm.EdmClientImpl; import org.apache.olingo.client.core.op.AbstractODataReader; -import org.apache.olingo.commons.api.edm.Edm; +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 { @@ -39,28 +42,42 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader } @Override - public Edm readMetadata(final InputStream input) { - return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input)); + public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) { + return ((ODataClient) client).getBinder(). + getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject()); } @Override - public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) { - return ((ODataClientImpl) client).getBinder().getODataServiceDocument( - ((ODataClientImpl) client).getDeserializer().toServiceDocument(input, format)); + 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)); + ((ODataClient) client).getDeserializer().toLinkCollection(input, format).getObject()); } @Override @SuppressWarnings("unchecked") - public <T> T read(final InputStream src, final String format, final Class<T> reference) { - return (ODataLinkCollection.class.isAssignableFrom(reference) - ? (T) readLinks(src, ODataFormat.fromString(format)) - : super.read(src, format, reference)); - } + public <T> Container<T> read(final InputStream src, final String format, final Class<T> reference) { + if (ODataLinkCollection.class.isAssignableFrom(reference)) { + final Container<LinkCollection> container = + ((ODataClient) client).getDeserializer().toLinkCollection(src, ODataFormat.fromString(format)); + return new Container<T>( + container.getContextURL(), + container.getMetadataETag(), + (T) ((ODataClient) client).getBinder().getLinkCollection(container.getObject())); + } else { + return super.read(src, format, reference); + } + } } 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 9c81baf90..226d8b8f5 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,13 +18,29 @@ */ 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; +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; +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 { @@ -34,26 +50,126 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder super(client); } + @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); - 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())); } 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 Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference, + final boolean setType) { + + 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; + } + + @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); + } + + @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)); + } + + @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; + } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java index f9368537a..08d35568b 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java @@ -28,6 +28,7 @@ import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl; import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl; import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl; import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl; +import org.apache.olingo.commons.api.data.Container; import org.apache.olingo.commons.core.op.AbstractODataDeserializer; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; @@ -49,10 +50,10 @@ public class ODataDeserializerImpl extends AbstractODataDeserializer implements } @Override - public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) { + public Container<ServiceDocument> toServiceDocument(final InputStream input, final ODataFormat format) { return format == ODataFormat.XML - ? xml(input, XMLServiceDocumentImpl.class) - : json(input, JSONServiceDocumentImpl.class); + ? this.<ServiceDocument, XMLServiceDocumentImpl>xml(input, XMLServiceDocumentImpl.class) + : this.<ServiceDocument, JSONServiceDocumentImpl>json(input, JSONServiceDocumentImpl.class); } } 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 1a93ce144..41f1e3b36 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 @@ -19,14 +19,15 @@ package org.apache.olingo.client.core.op.impl.v4; import java.io.InputStream; - -import org.apache.olingo.commons.api.domain.ODataServiceDocument; -import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.client.api.op.v4.ODataReader; import org.apache.olingo.client.api.v4.ODataClient; -import org.apache.olingo.client.core.edm.EdmClientImpl; import org.apache.olingo.client.core.op.AbstractODataReader; -import org.apache.olingo.commons.api.edm.Edm; +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 { @@ -37,13 +38,20 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader } @Override - public Edm readMetadata(final InputStream input) { - return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input)); + public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) { + return ((ODataClient) client).getBinder(). + getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject()); } @Override - public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) { - return ((ODataClient) client).getBinder().getODataServiceDocument( - ((ODataClient) client).getDeserializer().toServiceDocument(input, format)); + 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); } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java index 47100e88a..e55b3a1e2 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java @@ -20,12 +20,19 @@ package org.apache.olingo.client.core.uri; import org.apache.olingo.client.api.uri.FilterArg; import org.apache.olingo.client.api.uri.CommonFilterArgFactory; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; /** * OData filter arguments factory. */ public abstract class AbstractFilterArgFactory implements CommonFilterArgFactory { + private final ODataServiceVersion version; + + public AbstractFilterArgFactory(final ODataServiceVersion version) { + this.version = version; + } + @Override public FilterArg _null() { return new FilterConst("null"); @@ -38,7 +45,7 @@ public abstract class AbstractFilterArgFactory implements CommonFilterArgFactory @Override public FilterArg literal(final Object value) { - return new FilterLiteral(value); + return new FilterLiteral(version, value); } @Override diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java index eb6067e40..108c1bfb0 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java @@ -21,11 +21,18 @@ package org.apache.olingo.client.core.uri; import org.apache.olingo.client.api.uri.FilterArg; import org.apache.olingo.client.api.uri.CommonFilterFactory; import org.apache.olingo.client.api.uri.URIFilter; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; public abstract class AbstractFilterFactory implements CommonFilterFactory { private static final long serialVersionUID = -6141317149802621836L; + protected final ODataServiceVersion version; + + public AbstractFilterFactory(final ODataServiceVersion version) { + this.version = version; + } + @Override public URIFilter match(final FilterArg arg) { return new MatchFilter(arg); 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 2beecb37c..10feb7e3d 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,9 +18,12 @@ */ 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; import java.util.List; import java.util.Map; @@ -30,6 +33,7 @@ import org.apache.olingo.client.api.uri.QueryOption; import org.apache.olingo.client.api.uri.SegmentType; import org.apache.olingo.client.api.uri.CommonURIBuilder; import org.apache.olingo.client.api.uri.URIFilter; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,8 +64,8 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme public String getValue() { return value; } - } + private final ODataServiceVersion version; protected final List<Segment> segments = new ArrayList<Segment>(); @@ -70,13 +74,19 @@ 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 * service. */ - protected AbstractURIBuilder(final String serviceRoot) { + protected AbstractURIBuilder(final ODataServiceVersion version, final String serviceRoot) { + this.version = version; segments.add(new Segment(SegmentType.SERVICEROOT, serviceRoot)); } @@ -93,6 +103,12 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme return getThis(); } + @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)); @@ -101,7 +117,7 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme @Override public UB appendKeySegment(final Object val) { - final String segValue = URIUtils.escape(val); + final String segValue = URIUtils.escape(version, val); segments.add(new Segment(SegmentType.KEY, "(" + segValue + ")")); return getThis(); @@ -111,17 +127,11 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme @Override public UB appendKeySegment(final Map<String, Object> segmentValues) { - if (segmentValues == null || segmentValues.isEmpty()) { + final String key = buildMultiKeySegment(segmentValues, true); + if (StringUtils.isEmpty(key)) { segments.add(new Segment(SegmentType.KEY, noKeysWrapper())); } else { - final StringBuilder keyBuilder = new StringBuilder().append('('); - for (Map.Entry<String, Object> entry : segmentValues.entrySet()) { - keyBuilder.append(entry.getKey()).append('=').append(URIUtils.escape(entry.getValue())); - keyBuilder.append(','); - } - keyBuilder.deleteCharAt(keyBuilder.length() - 1).append(')'); - - segments.add(new Segment(SegmentType.KEY, keyBuilder.toString())); + segments.add(new Segment(SegmentType.KEY, key)); } return getThis(); @@ -179,7 +189,14 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme @Override public UB expand(final String... expandItems) { - return addQueryOption(QueryOption.EXPAND, StringUtils.join(expandItems, ",")); + final List<String> values = new ArrayList<String>(); + if (queryOptions.containsKey(QueryOption.EXPAND.toString())) { + values.add(queryOptions.get(QueryOption.EXPAND.toString())); + } + + values.addAll(Arrays.asList(expandItems)); + + return addQueryOption(QueryOption.EXPAND, StringUtils.join(values, ",")); } @Override @@ -189,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 @@ -199,7 +221,14 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme @Override public UB select(final String... selectItems) { - return addQueryOption(QueryOption.SELECT, StringUtils.join(selectItems, ",")); + final List<String> values = new ArrayList<String>(); + if (queryOptions.containsKey(QueryOption.SELECT.toString())) { + values.add(queryOptions.get(QueryOption.SELECT.toString())); + } + + values.addAll(Arrays.asList(selectItems)); + + return addQueryOption(QueryOption.SELECT, StringUtils.join(values, ",")); } @Override @@ -260,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); @@ -271,4 +304,19 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme return build().toASCIIString(); } + protected String buildMultiKeySegment(final Map<String, Object> segmentValues, final boolean escape) { + if (segmentValues == null || segmentValues.isEmpty()) { + return StringUtils.EMPTY; + } else { + final StringBuilder keyBuilder = new StringBuilder().append('('); + for (Map.Entry<String, Object> entry : segmentValues.entrySet()) { + keyBuilder.append(entry.getKey()).append('=').append( + escape ? URIUtils.escape(version, entry.getValue()) : entry.getValue()); + keyBuilder.append(','); + } + keyBuilder.deleteCharAt(keyBuilder.length() - 1).append(')'); + + return keyBuilder.toString(); + } + } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java index cef0349a0..ad0393400 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java @@ -19,22 +19,26 @@ package org.apache.olingo.client.core.uri; import org.apache.olingo.client.api.uri.FilterArg; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; /** * Filter value literals; obtain instances via <tt>FilterArgFactory</tt>. * - * @see FilterArgFactory + * @see org.apache.olingo.client.api.uri.v3.FilterArgFactory */ public class FilterLiteral implements FilterArg { + private final ODataServiceVersion version; + private final Object value; - FilterLiteral(final Object value) { + FilterLiteral(final ODataServiceVersion version, final Object value) { + this.version = version; this.value = value; } @Override public String build() { - return URIUtils.escape(value); + return URIUtils.escape(version, value); } } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaderValues.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java similarity index 60% rename from lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaderValues.java rename to lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java index 37c4698e6..dd3d67bfb 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaderValues.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java @@ -16,30 +16,33 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.api.communication.header; +package org.apache.olingo.client.core.uri; /** - * Constant header values class. + * Object to be used to communicate parameter alias into filter or orderBy expression. */ -public class ODataHeaderValues { +public class ParameterAlias { /** - * <code>Prefer</code> header, return content. + * Parameter alias. + */ + final String alias; + + /** + * Constructor. * - * @see ODataHeaders.HeaderName#prefer + * @param alias parameter alias. */ - public static final String preferReturnContent = "return-content"; + public ParameterAlias(final String alias) { + this.alias = alias; + } /** - * <code>Prefer</code> header, return no content. + * Gets parameter alias. * - * @see ODataHeaders.HeaderName#prefer + * @return */ - public static final String preferReturnNoContent = "return-no-content"; - - /** - * @see ODataHeaders.HeaderName#dataServiceUrlConventions - */ - public static final String keyAsSegment = "KeyAsSegment"; - + public String getAlias() { + return alias; + } } 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 36bb1c24b..17cfcd0ae 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 @@ -21,27 +21,43 @@ package org.apache.olingo.client.core.uri; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.net.URI; import java.net.URLEncoder; import java.sql.Timestamp; import java.util.Calendar; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; import java.util.UUID; +import java.util.regex.Pattern; import javax.xml.datatype.Duration; import org.apache.commons.codec.binary.Hex; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.entity.InputStreamEntity; import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.edm.EdmEntityContainer; import org.apache.olingo.commons.api.edm.EdmFunctionImport; +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.api.edm.geo.Geospatial; +import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary; +import org.apache.olingo.commons.core.edm.primitivetype.EdmDate; import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTime; import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset; import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal; import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble; +import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration; import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64; +import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; import org.apache.olingo.commons.core.edm.primitivetype.EdmSingle; import org.apache.olingo.commons.core.edm.primitivetype.EdmTime; +import org.apache.olingo.commons.core.edm.primitivetype.EdmTimeOfDay; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,6 +71,8 @@ public final class URIUtils { */ private static final Logger LOG = LoggerFactory.getLogger(URIUtils.class); + private static final Pattern ENUM_VALUE = Pattern.compile("(.+\\.)?.+'.+'"); + private URIUtils() { // Empty private constructor for static utility classes } @@ -141,44 +159,225 @@ public final class URIUtils { return result.toString(); } + private static String prefix(final ODataServiceVersion version, final EdmPrimitiveTypeKind typeKind) { + String result = StringUtils.EMPTY; + if (version == ODataServiceVersion.V30) { + switch (typeKind) { + case Guid: + result = "guid'"; + break; + + case DateTime: + result = "datetime'"; + break; + + case DateTimeOffset: + result = "datetimeoffset'"; + break; + + case Binary: + result = "X'"; + break; + + default: + } + } + + return result; + } + + private static String suffix(final ODataServiceVersion version, final EdmPrimitiveTypeKind typeKind) { + String result = StringUtils.EMPTY; + if (version == ODataServiceVersion.V30) { + switch (typeKind) { + case Guid: + case DateTime: + case DateTimeOffset: + result = "'"; + break; + + case Decimal: + result = "M"; + break; + + case Double: + result = "D"; + break; + + case Single: + result = "f"; + break; + + case Int64: + result = "L"; + break; + + default: + } + } + + return result; + } + + private static String timestamp(final ODataServiceVersion version, final Timestamp timestamp) + throws UnsupportedEncodingException, EdmPrimitiveTypeException { + + 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) + + suffix(version, EdmPrimitiveTypeKind.DateTime) + : URLEncoder.encode(EdmDateTimeOffset.getInstance(). + valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), + Constants.UTF8); + } + + private static String calendar(final ODataServiceVersion version, final Calendar calendar) + throws UnsupportedEncodingException, EdmPrimitiveTypeException { + + String result; + if (calendar.get(Calendar.ZONE_OFFSET) == 0) { + 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) + + suffix(version, EdmPrimitiveTypeKind.DateTime); + } else { + if (calendar.get(Calendar.YEAR) == 0 && calendar.get(Calendar.MONTH) == 0 + && calendar.get(Calendar.DAY_OF_MONTH) == 0) { + + result = URLEncoder.encode(EdmTimeOfDay.getInstance(). + valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), + Constants.UTF8); + } else { + result = URLEncoder.encode(EdmDate.getInstance(). + valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), + Constants.UTF8); + } + } + } else { + result = prefix(version, EdmPrimitiveTypeKind.DateTimeOffset) + + URLEncoder.encode(EdmDateTimeOffset.getInstance(). + valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), + Constants.UTF8) + + suffix(version, EdmPrimitiveTypeKind.DateTimeOffset); + } + + return result; + } + + private static String duration(final ODataServiceVersion version, final Duration duration) + throws UnsupportedEncodingException, EdmPrimitiveTypeException { + + return version == ODataServiceVersion.V30 + ? EdmTime.getInstance().toUriLiteral(URLEncoder.encode(EdmTime.getInstance(). + 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)); + } + + private static String quoteString(final String string, final boolean singleQuoteEscape) + throws UnsupportedEncodingException { + + final String encoded = URLEncoder.encode(string, Constants.UTF8); + return ENUM_VALUE.matcher(string).matches() + ? encoded + : singleQuoteEscape + ? "'" + encoded + "'" + : "\"" + encoded + "\""; + } + /** * Turns primitive values into their respective URI representation. * + * @param version OData protocol version * @param obj primitive value * @return URI representation */ - public static String escape(final Object obj) { + public static String escape(final ODataServiceVersion version, final Object obj) { + return escape(version, obj, true); + } + + private static String escape(final ODataServiceVersion version, final Object obj, final boolean singleQuoteEscape) { String value; try { - value = (obj instanceof UUID) - ? "guid'" + obj.toString() + "'" - : (obj instanceof byte[]) - ? "X'" + Hex.encodeHexString((byte[]) obj) + "'" - : (obj instanceof Timestamp) - ? "datetime'" + URLEncoder.encode(EdmDateTime.getInstance(). - valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'" - : (obj instanceof Calendar) - ? "datetimeoffset'" + URLEncoder.encode(EdmDateTimeOffset.getInstance(). - valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'" - : (obj instanceof Duration) - ? "time'" + URLEncoder.encode(EdmTime.getInstance(). - valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'" - : (obj instanceof BigDecimal) - ? EdmDecimal.getInstance().valueToString(obj, null, null, - Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null) + "M" - : (obj instanceof Double) - ? EdmDouble.getInstance().valueToString(obj, null, null, - Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null) + "D" - : (obj instanceof Float) - ? EdmSingle.getInstance().valueToString(obj, null, null, - Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null) + "f" - : (obj instanceof Long) - ? EdmInt64.getInstance().valueToString(obj, null, null, - Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null) + "L" - : (obj instanceof String) - ? "'" + URLEncoder.encode((String) obj, Constants.UTF8) + "'" - : obj.toString(); + if (obj == null) { + value = Constants.ATTR_NULL; + } else if (version == ODataServiceVersion.V40 && obj instanceof Collection) { + final StringBuffer buffer = new StringBuffer("["); + for (@SuppressWarnings("unchecked") + final Iterator<Object> itor = ((Collection<Object>) obj).iterator(); itor.hasNext();) { + buffer.append(escape(version, itor.next(), false)); + if (itor.hasNext()) { + buffer.append(','); + } + } + buffer.append(']'); + + value = buffer.toString(); + } else if (version == ODataServiceVersion.V40 && obj instanceof Map) { + final StringBuffer buffer = new StringBuffer("{"); + for (@SuppressWarnings("unchecked") + final Iterator<Map.Entry<Object, Object>> itor = + ((Map<Object, Object>) obj).entrySet().iterator(); itor.hasNext();) { + + final Map.Entry<Object, Object> entry = itor.next(); + buffer.append("\"").append(URLEncoder.encode(entry.getKey().toString(), Constants.UTF8)).append("\""); + buffer.append(':').append(escape(version, entry.getValue(), false)); + + if (itor.hasNext()) { + buffer.append(','); + } + } + buffer.append('}'); + + value = buffer.toString(); + } else { + value = (obj instanceof ParameterAlias) + ? "@" + ((ParameterAlias) obj).getAlias() + : (obj instanceof Boolean) + ? BooleanUtils.toStringTrueFalse((Boolean) obj) + : (obj instanceof UUID) + ? prefix(version, EdmPrimitiveTypeKind.Guid) + + obj.toString() + + suffix(version, EdmPrimitiveTypeKind.Guid) + : (obj instanceof byte[]) + ? EdmBinary.getInstance().toUriLiteral(Hex.encodeHexString((byte[]) obj)) + : (obj instanceof Timestamp) + ? timestamp(version, (Timestamp) obj) + : (obj instanceof Calendar) + ? calendar(version, (Calendar) obj) + : (obj instanceof Duration) + ? duration(version, (Duration) obj) + : (obj instanceof BigDecimal) + ? EdmDecimal.getInstance().valueToString(obj, null, 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) + + suffix(version, EdmPrimitiveTypeKind.Double) + : (obj instanceof Float) + ? EdmSingle.getInstance().valueToString(obj, null, 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) + + 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) + : (obj instanceof String) + ? quoteString((String) obj, singleQuoteEscape) + : obj.toString(); + } } catch (Exception e) { LOG.warn("While escaping '{}', using toString()", obj, e); value = obj.toString(); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterArgFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterArgFactoryImpl.java index c4c176c7c..e5ed489c4 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterArgFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterArgFactoryImpl.java @@ -22,9 +22,14 @@ import org.apache.olingo.client.api.uri.FilterArg; import org.apache.olingo.client.api.uri.v3.FilterArgFactory; import org.apache.olingo.client.core.uri.AbstractFilterArgFactory; import org.apache.olingo.client.core.uri.FilterFunction; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; public class FilterArgFactoryImpl extends AbstractFilterArgFactory implements FilterArgFactory { + public FilterArgFactoryImpl(final ODataServiceVersion version) { + super(version); + } + @Override public FilterArg substringof(final FilterArg first, final FilterArg second) { return new FilterFunction("substringof", first, second); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterFactoryImpl.java index a26cd5191..a42a92050 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterFactoryImpl.java @@ -21,14 +21,19 @@ package org.apache.olingo.client.core.uri.v3; import org.apache.olingo.client.api.uri.v3.FilterArgFactory; import org.apache.olingo.client.api.uri.v3.FilterFactory; import org.apache.olingo.client.core.uri.AbstractFilterFactory; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; public class FilterFactoryImpl extends AbstractFilterFactory implements FilterFactory { private static final long serialVersionUID = 1092594961118334631L; + public FilterFactoryImpl(final ODataServiceVersion version) { + super(version); + } + @Override public FilterArgFactory getArgFactory() { - return new FilterArgFactoryImpl(); + return new FilterArgFactoryImpl(version); } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java index b541579ed..f02c524cb 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java @@ -27,15 +27,21 @@ import org.apache.olingo.client.api.uri.QueryOption; import org.apache.olingo.client.api.uri.SegmentType; import org.apache.olingo.client.api.uri.v3.URIBuilder; import org.apache.olingo.client.core.uri.AbstractURIBuilder; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; public class URIBuilderImpl extends AbstractURIBuilder<URIBuilder> implements URIBuilder { private static final long serialVersionUID = -3506851722447870532L; + private final ODataServiceVersion version; + private final Configuration configuration; - public URIBuilderImpl(final Configuration configuration, final String serviceRoot) { - super(serviceRoot); + public URIBuilderImpl(final ODataServiceVersion version, final Configuration configuration, + final String serviceRoot) { + + super(version, serviceRoot); + this.version = version; this.configuration = configuration; } @@ -70,7 +76,7 @@ public class URIBuilderImpl extends AbstractURIBuilder<URIBuilder> implements UR @Override public URIBuilder appendKeySegment(final Object val) { if (configuration.isKeyAsSegment()) { - final String segValue = URIUtils.escape(val); + final String segValue = URIUtils.escape(version, val); segments.add(new Segment(SegmentType.KEY_AS_SEGMENT, segValue)); } else { super.appendKeySegment(val); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterArgFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterArgFactoryImpl.java index 39298f3e6..15bb9e9f2 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterArgFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterArgFactoryImpl.java @@ -24,9 +24,14 @@ import org.apache.olingo.client.api.uri.v4.FilterArgFactory; import org.apache.olingo.client.core.uri.AbstractFilterArgFactory; import org.apache.olingo.client.core.uri.FilterFunction; import org.apache.olingo.client.core.uri.FilterLambda; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; public class FilterArgFactoryImpl extends AbstractFilterArgFactory implements FilterArgFactory { + public FilterArgFactoryImpl(final ODataServiceVersion version) { + super(version); + } + @Override public FilterArg contains(final FilterArg first, final FilterArg second) { return new FilterFunction("contains", first, second); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterFactoryImpl.java index 2acf1c3b4..626a2618a 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterFactoryImpl.java @@ -26,14 +26,19 @@ import org.apache.olingo.client.core.uri.AbstractFilterFactory; import org.apache.olingo.client.core.uri.FilterProperty; import org.apache.olingo.client.core.uri.HasFilter; import org.apache.olingo.commons.api.edm.EdmEnumType; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; public class FilterFactoryImpl extends AbstractFilterFactory implements FilterFactory { private static final long serialVersionUID = -5358934829490623191L; + public FilterFactoryImpl(ODataServiceVersion version) { + super(version); + } + @Override public FilterArgFactory getArgFactory() { - return new FilterArgFactoryImpl(); + return new FilterArgFactoryImpl(version); } @Override diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java index ae4284d91..332f8c2aa 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java @@ -18,18 +18,41 @@ */ package org.apache.olingo.client.core.uri.v4; +import java.util.LinkedHashMap; +import java.util.Map; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; import org.apache.olingo.client.api.uri.QueryOption; import org.apache.olingo.client.api.uri.SegmentType; import org.apache.olingo.client.api.uri.v4.URIBuilder; import org.apache.olingo.client.core.uri.AbstractURIBuilder; +import org.apache.olingo.commons.api.edm.EdmEnumType; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; public class URIBuilderImpl extends AbstractURIBuilder<URIBuilder> implements URIBuilder { private static final long serialVersionUID = -3506851722447870532L; - public URIBuilderImpl(final String serviceRoot) { - super(serviceRoot); + public URIBuilderImpl(final ODataServiceVersion version, final String serviceRoot) { + super(version, serviceRoot); + } + + @Override + public URIBuilder appendKeySegment(final EdmEnumType enumType, final String memberName) { + return appendKeySegment(enumType.toUriLiteral(memberName)); + } + + @Override + public URIBuilder appendKeySegment(final Map<String, Pair<EdmEnumType, String>> enumValues, + final Map<String, Object> segmentValues) { + + final Map<String, Object> values = new LinkedHashMap<String, Object>(); + for (Map.Entry<String, Pair<EdmEnumType, String>> entry : enumValues.entrySet()) { + values.put(entry.getKey(), entry.getValue().getKey().toUriLiteral(entry.getValue().getValue())); + } + values.putAll(segmentValues); + + return appendKeySegment(values); } @Override @@ -78,11 +101,6 @@ public class URIBuilderImpl extends AbstractURIBuilder<URIBuilder> implements UR return getThis(); } - @Override - public URIBuilder count(final boolean value) { - return addQueryOption(QueryOption.COUNT, Boolean.toString(value)); - } - @Override public URIBuilder appendAllSegment() { segments.add(new Segment(SegmentType.ALL, SegmentType.ALL.getValue())); @@ -99,4 +117,13 @@ public class URIBuilderImpl extends AbstractURIBuilder<URIBuilder> implements UR return addQueryOption(QueryOption.SEARCH, expression); } + @Override + public URIBuilder count(final boolean value) { + return addQueryOption(QueryOption.COUNT, Boolean.toString(value)); + } + + @Override + public URIBuilder expandWithOptions(final String expandItem, final Map<String, Object> options) { + return expand(expandItem + buildMultiKeySegment(options, false)); + } } 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 d10c87410..f1b5d239c 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 { @@ -54,7 +56,7 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient private final Configuration configuration = new ConfigurationImpl(); - private final FilterFactory filterFactory = new FilterFactoryImpl(); + private final FilterFactory filterFactory = new FilterFactoryImpl(getServiceVersion()); private final ODataDeserializer deserializer = new ODataDeserializerImpl(getServiceVersion()); @@ -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); @@ -95,7 +99,7 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient @Override public URIBuilder getURIBuilder(final String serviceRoot) { - return new URIBuilderImpl(configuration, serviceRoot); + return new URIBuilderImpl(getServiceVersion(), configuration, serviceRoot); } @Override @@ -123,6 +127,11 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient return binder; } + @Override + public ODataObjectFactory getObjectFactory() { + return objectFactory; + } + @Override public RetrieveRequestFactory getRetrieveRequestFactory() { return retrieveReqFact; 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 bb12f1add..d379bcf53 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 { @@ -54,7 +56,7 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient private final Configuration configuration = new ConfigurationImpl(); - private final FilterFactory filterFactory = new FilterFactoryImpl(); + private final FilterFactory filterFactory = new FilterFactoryImpl(getServiceVersion()); private final ODataDeserializer deserializer = new ODataDeserializerImpl(getServiceVersion()); @@ -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); @@ -82,8 +86,8 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient @Override public ODataHeaders getVersionHeaders() { final ODataHeadersImpl odataHeaders = new ODataHeadersImpl(); - odataHeaders.setHeader(HeaderName.maxDataServiceVersion, ODataServiceVersion.V40.toString()); - odataHeaders.setHeader(HeaderName.dataServiceVersion, ODataServiceVersion.V40.toString()); + odataHeaders.setHeader(HeaderName.odataMaxVersion, ODataServiceVersion.V40.toString()); + odataHeaders.setHeader(HeaderName.odataVersion, ODataServiceVersion.V40.toString()); return odataHeaders; } @@ -94,7 +98,7 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient @Override public URIBuilder getURIBuilder(final String serviceRoot) { - return new URIBuilderImpl(serviceRoot); + return new URIBuilderImpl(getServiceVersion(), serviceRoot); } @Override @@ -122,6 +126,11 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient return binder; } + @Override + public ODataObjectFactory getObjectFactory() { + return objectFactory; + } + @Override public RetrieveRequestFactory getRetrieveRequestFactory() { return retrieveReqFact; diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java deleted file mode 100644 index 21d8c5d49..000000000 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java +++ /dev/null @@ -1,429 +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; - -import java.io.File; -import java.io.InputStream; -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; -import org.apache.commons.codec.binary.Base64; -import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.ODataGeospatialValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.format.ODataFormat; -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.api.edm.geo.Geospatial; -import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension; -import org.apache.olingo.commons.api.edm.geo.GeospatialCollection; -import org.apache.olingo.commons.api.edm.geo.LineString; -import org.apache.olingo.commons.api.edm.geo.MultiLineString; -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 static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public abstract class AbstractPrimitiveTest extends AbstractTest { - - protected abstract ODataFormat getFormat(); - - protected ODataServiceVersion getVersion() { - return getClient().getServiceVersion(); - } - - protected String getFilename(final String entity, final String propertyName) { - return getVersion().name().toLowerCase() - + File.separatorChar - + entity.replace('(', '_').replace(")", "") - + "_" + propertyName.replaceAll("/", "_") + "." + getSuffix(getFormat()); - } - - protected ODataPrimitiveValue writePrimitiveValue(final ODataPrimitiveValue value) { - final ODataPrimitiveValue newValue = getClient().getPrimitiveValueBuilder(). - setType(value.getTypeKind()). - setValue(value.toValue()).build(); - - final InputStream written = getClient().getWriter().writeProperty( - getClient().getObjectFactory().newPrimitiveProperty(Constants.ELEM_PROPERTY, newValue), - getFormat()); - return readPrimitiveValue(written); - } - - protected ODataPrimitiveValue readPrimitiveValue(final InputStream input) { - final ODataProperty property = getClient().getReader().readProperty(input, getFormat()); - assertNotNull(property); - assertTrue(property.hasPrimitiveValue()); - assertNotNull(property.getPrimitiveValue()); - - return property.getPrimitiveValue(); - } - - protected ODataPrimitiveValue readPrimitiveValue(final String entity, final String propertyName) { - final ODataPrimitiveValue value = - readPrimitiveValue(getClass().getResourceAsStream(getFilename(entity, propertyName))); - - assertEquals(value.toString(), writePrimitiveValue(value).toString()); - - return value; - } - - protected ODataGeospatialValue writeGeospatialValue(final ODataGeospatialValue value) { - final ODataGeospatialValue newValue = getClient().getGeospatialValueBuilder(). - setType(value.getTypeKind()). - setValue(value.toValue()). - build(); - final InputStream written = getClient().getWriter().writeProperty( - getClient().getObjectFactory().newPrimitiveProperty(Constants.ELEM_PROPERTY, newValue), - getFormat()); - return readGeospatialValue(written); - } - - protected ODataGeospatialValue readGeospatialValue(final InputStream input) { - final ODataProperty property = getClient().getReader().readProperty(input, getFormat()); - assertNotNull(property); - assertTrue(property.hasGeospatialValue()); - assertNotNull(property.getGeospatialValue()); - - return property.getGeospatialValue(); - } - - protected ODataGeospatialValue readGeospatialValue(final String entity, final String propertyName) { - final ODataGeospatialValue value = - readGeospatialValue(getClass().getResourceAsStream(getFilename(entity, propertyName))); - - assertEquals(value.toValue(), writeGeospatialValue(value).toValue()); - - return value; - } - - protected void int32(final String entity, final String propertyName, final int check) - throws EdmPrimitiveTypeException { - - final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName); - assertEquals(EdmPrimitiveTypeKind.Int32, opv.getTypeKind()); - - final Integer value = opv.toCastValue(Integer.class); - assertNotNull(value); - assertTrue(check == value); - } - - protected void string(final String entity, final String propertyName, final String check) - throws EdmPrimitiveTypeException { - - final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName); - assertEquals(EdmPrimitiveTypeKind.String, opv.getTypeKind()); - - final String value = opv.toCastValue(String.class); - assertNotNull(value); - assertEquals(check, value); - - assertEquals(opv, writePrimitiveValue(opv)); - } - - protected void decimal(final String entity, final String propertyName, final BigDecimal check) - throws EdmPrimitiveTypeException { - - final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName); - assertEquals(EdmPrimitiveTypeKind.Decimal, opv.getTypeKind()); - - final BigDecimal value = opv.toCastValue(BigDecimal.class); - assertNotNull(value); - assertTrue(check.equals(value)); - } - - protected void datetime(final String entity, final String propertyName, final String check) - throws EdmPrimitiveTypeException { - - final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName); - assertEquals(EdmPrimitiveTypeKind.DateTime, opv.getTypeKind()); - - final Timestamp value = opv.toCastValue(Timestamp.class); - assertNotNull(value); - assertEquals(check, opv.toString()); - } - - protected void guid(final String entity, final String propertyName, final String check) - throws EdmPrimitiveTypeException { - - final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName); - assertEquals(EdmPrimitiveTypeKind.Guid, opv.getTypeKind()); - - final UUID value = opv.toCastValue(UUID.class); - assertNotNull(value); - assertEquals(check, opv.toString()); - } - - protected void binary(final String entity, final String propertyName) throws EdmPrimitiveTypeException { - final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName); - assertEquals(EdmPrimitiveTypeKind.Binary, opv.getTypeKind()); - - final byte[] value = opv.toCastValue(byte[].class); - assertNotNull(value); - assertTrue(value.length > 0); - assertTrue(Base64.isBase64(opv.toString())); - } - - private void checkPoint(final Point point, final Point check) { - assertEquals(check.getX(), point.getX(), 0); - assertEquals(check.getY(), point.getY(), 0); - assertEquals(check.getZ(), point.getZ(), 0); - } - - protected void point( - final String entity, - final String propertyName, - final Point expectedValues, - final EdmPrimitiveTypeKind expectedType, - final Dimension expectedDimension) { - - final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName); - assertEquals(expectedType, opv.getTypeKind()); - - final Point point = opv.toCastValue(Point.class); - assertNotNull(point); - assertEquals(expectedDimension, point.getDimension()); - - checkPoint(point, expectedValues); - } - - private void checkLine(final LineString line, final List<Point> check) { - final List<Point> points = new ArrayList<Point>(); - - for (Point point : line) { - points.add(point); - } - - assertEquals(check.size(), points.size()); - - for (int i = 0; i < points.size(); i++) { - checkPoint(points.get(i), check.get(i)); - } - } - - protected void lineString( - final String entity, - final String propertyName, - final List<Point> check, - final EdmPrimitiveTypeKind expectedType, - final Dimension expectedDimension) { - - final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName); - assertEquals(expectedType, opv.getTypeKind()); - - final LineString lineString = opv.toCastValue(LineString.class); - assertNotNull(lineString); - assertEquals(expectedDimension, lineString.getDimension()); - - checkLine(lineString, check); - } - - protected void multiPoint( - final String entity, - final String propertyName, - final List<Point> check, - final EdmPrimitiveTypeKind expectedType, - final Dimension expectedDimension) { - - final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName); - assertEquals(expectedType, opv.getTypeKind()); - - final MultiPoint multiPoint = opv.toCastValue(MultiPoint.class); - assertNotNull(multiPoint); - assertEquals(expectedDimension, multiPoint.getDimension()); - - final List<Point> points = new ArrayList<Point>(); - - for (Point point : multiPoint) { - points.add(point); - } - - assertEquals(check.size(), points.size()); - - for (int i = 0; i < points.size(); i++) { - checkPoint(points.get(i), check.get(i)); - } - } - - protected void multiLine( - final String entity, - final String propertyName, - final List<List<Point>> check, - final EdmPrimitiveTypeKind expectedType, - final Dimension expectedDimension) { - - final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName); - assertEquals(expectedType, opv.getTypeKind()); - - final MultiLineString multiLine = opv.toCastValue(MultiLineString.class); - assertNotNull(multiLine); - assertEquals(expectedDimension, multiLine.getDimension()); - - final List<LineString> lines = new ArrayList<LineString>(); - - int i = 0; - for (LineString line : multiLine) { - checkLine(line, check.get(i)); - i++; - } - } - - private void checkPoligon( - final Polygon polygon, - final List<Point> checkInterior, - final List<Point> checkExterior) { - - final List<Point> points = new ArrayList<Point>(); - - for (Point point : polygon.getInterior()) { - points.add(point); - } - - assertEquals(checkInterior.size(), points.size()); - - for (int i = 0; i < points.size(); i++) { - checkPoint(checkInterior.get(i), points.get(i)); - } - - points.clear(); - - for (Point point : polygon.getExterior()) { - points.add(point); - } - - assertEquals(checkExterior.size(), points.size()); - - for (int i = 0; i < points.size(); i++) { - checkPoint(checkExterior.get(i), points.get(i)); - } - - } - - protected void polygon( - final String entity, - final String propertyName, - final List<Point> checkInterior, - final List<Point> checkExterior, - final EdmPrimitiveTypeKind expectedType, - final Dimension expectedDimension) { - - final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName); - assertEquals(expectedType, opv.getTypeKind()); - - final Polygon polygon = opv.toCastValue(Polygon.class); - - assertNotNull(polygon); - assertEquals(expectedDimension, polygon.getDimension()); - - checkPoligon(polygon, checkInterior, checkExterior); - - } - - protected void multiPolygon( - final String entity, - final String propertyName, - final List<List<Point>> checkInterior, - final List<List<Point>> checkExterior, - final EdmPrimitiveTypeKind expectedType, - final Dimension expectedDimension) { - - final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName); - assertEquals(expectedType, opv.getTypeKind()); - - final MultiPolygon multiPolygon = opv.toCastValue(MultiPolygon.class); - assertNotNull(multiPolygon); - assertEquals(expectedDimension, multiPolygon.getDimension()); - - int i = 0; - for (Polygon polygon : multiPolygon) { - checkPoligon( - polygon, - checkInterior.isEmpty() ? Collections.<Point>emptyList() : checkInterior.get(i), - checkExterior.isEmpty() ? Collections.<Point>emptyList() : checkExterior.get(i)); - i++; - } - } - - protected void geomCollection( - final String entity, - final String propertyName, - final EdmPrimitiveTypeKind expectedType, - final Dimension expectedDimension) { - - final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName); - assertEquals(expectedType, opv.getTypeKind()); - - final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class); - assertNotNull(collection); - assertEquals(expectedDimension, collection.getDimension()); - - final Iterator<Geospatial> itor = collection.iterator(); - int count = 0; - while (itor.hasNext()) { - count++; - - final Geospatial geospatial = itor.next(); - if (count == 1) { - assertTrue(geospatial instanceof Point); - } - if (count == 2) { - assertTrue(geospatial instanceof LineString); - } - } - assertEquals(2, count); - } - - protected void geogCollection( - final String entity, - final String propertyName, - final EdmPrimitiveTypeKind expectedType, - final Dimension expectedDimension) { - - final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName); - assertEquals(expectedType, opv.getTypeKind()); - - final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class); - assertNotNull(collection); - assertEquals(expectedDimension, collection.getDimension()); - - final Iterator<Geospatial> itor = collection.iterator(); - int count = 0; - while (itor.hasNext()) { - count++; - - final Geospatial geospatial = itor.next(); - if (count == 1) { - assertTrue(geospatial instanceof GeospatialCollection); - } - if (count == 2) { - assertTrue(geospatial instanceof GeospatialCollection); - } - } - assertEquals(2, count); - } -} diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java index b579962b3..04a5c9673 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java @@ -18,8 +18,6 @@ */ package org.apache.olingo.client.core; -import java.util.Locale; - import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.format.ODataPubFormat; @@ -43,14 +41,6 @@ public abstract class AbstractTest { XMLUnit.setCompareUnmatched(false); } - /** - * This is needed for correct number handling (Double, for example). - */ - @BeforeClass - public static void setEnglishLocale() { - Locale.setDefault(Locale.ENGLISH); - } - @BeforeClass public static void setClientInstances() { v3Client = ODataClientFactory.getV3(); 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 1293f3cae..4f6542119 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,12 +20,15 @@ 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() { return "http://localhost:9080/StaticService/" + getClient().getServiceVersion().name() + "/Static.svc"; } + + protected String getNorthwindServiceRoot() { + return "http://localhost:9080/StaticService/" + getClient().getServiceVersion().name() + "/NorthWind.svc"; + } } 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 9b4bd393b..000000000 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java +++ /dev/null @@ -1,550 +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.UpdateType; -import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; -import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; -import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest; -import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; -import org.apache.olingo.client.api.communication.response.ODataDeleteResponse; -import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; -import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; -import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; -import org.apache.olingo.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.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.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 ODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity(); - assertNotNull(originalInline); - - final ODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity(); - assertNotNull(actualInline); - - checkProperties(originalInline.getProperties(), actualInline.getProperties()); - } - } - } - - protected void checkProperties(final Collection<ODataProperty> original, final Collection<ODataProperty> actual) { - assertTrue(original.size() <= actual.size()); - - // re-organize actual properties into a Map<String, ODataProperty> - final Map<String, ODataProperty> actualProps = new HashMap<String, ODataProperty>(actual.size()); - - for (ODataProperty prop : actual) { - assertFalse(actualProps.containsKey(prop.getName())); - actualProps.put(prop.getName(), prop); - } - - assertTrue(actual.size() <= actualProps.size()); - - for (ODataProperty prop : original) { - assertNotNull(prop); - if (actualProps.containsKey(prop.getName())) { - final ODataProperty actualProp = actualProps.get(prop.getName()); - assertNotNull(actualProp); - - if (prop.getValue() != null && actualProp.getValue() != null) { - checkPropertyValue(prop.getName(), prop.getValue(), actualProp.getValue()); - } - } else { - // nothing ... maybe :FC_KeepInContent="false" - // ..... no assert can be done .... - } - } - } - - protected void checkPropertyValue(final String propertyName, - final ODataValue original, final ODataValue actual) { - - assertNotNull("Null original value for " + propertyName, original); - assertNotNull("Null actual value for " + propertyName, actual); - - assertEquals("Type mismatch for '" + propertyName + "': " - + original.getClass().getSimpleName() + "-" + actual.getClass().getSimpleName(), - original.getClass().getSimpleName(), actual.getClass().getSimpleName()); - - if (original.isComplex()) { - final List<ODataProperty> originalFileds = new ArrayList<ODataProperty>(); - for (ODataProperty prop : original.asComplex()) { - originalFileds.add(prop); - } - - final List<ODataProperty> actualFileds = new ArrayList<ODataProperty>(); - for (ODataProperty prop : (ODataComplexValue) actual) { - actualFileds.add(prop); - } - - checkProperties(originalFileds, actualFileds); - } else if (original.isCollection()) { - assertTrue(original.asCollection().size() <= actual.asCollection().size()); - - boolean found = original.asCollection().isEmpty(); - - for (ODataValue originalValue : original.asCollection()) { - for (ODataValue actualValue : actual.asCollection()) { - try { - checkPropertyValue(propertyName, originalValue, actualValue); - found = true; - } catch (AssertionError ignore) { - // ignore - } - } - } - - assertTrue("Found " + actual + " but expected " + original, found); - } else { - assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive(). - 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); - - entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information", - getClient().getPrimitiveValueBuilder().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 - entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name", - getClient().getPrimitiveValueBuilder().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())); - - // add BackupContactInfo attribute (collection) - final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue( - "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( - "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(). - 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(). - 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( - "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(). - 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 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 createReq = - getClient().getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original); - createReq.setFormat(format); - - final ODataEntityCreateResponse createRes = createReq.execute(); - assertEquals(201, createRes.getStatusCode()); - assertEquals("Created", createRes.getStatusMessage()); - - final ODataEntity created = createRes.getBody(); - assertNotNull(created); - - debugODataEntity(created, "Just created"); - - return created; - } - - protected ODataEntity compareEntities(final String serviceRootURL, - final ODataPubFormat format, - final ODataEntity original, - final int actualObjectId, - final Collection<String> expands) { - - final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL). - appendEntitySetSegment("Customer").appendKeySegment(actualObjectId); - - // search expanded - if (expands != null) { - for (String expand : expands) { - uriBuilder.expand(expand); - } - } - - final ODataEntityRequest 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 ODataEntity inline = ((ODataInlineEntity) link).getEntity(); - if (inline.getEditLink() != null) { - toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString())); - } - } - - if (link instanceof ODataInlineEntitySet) { - final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet(); - for (ODataEntity entity : inline.getEntities()) { - if (entity.getEditLink() != null) { - toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString())); - } - } - } - } - } - - assertFalse(toBeDeleted.isEmpty()); - - for (URI link : toBeDeleted) { - final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(link); - final ODataDeleteResponse deleteRes = deleteReq.execute(); - - assertEquals(204, deleteRes.getStatusCode()); - assertEquals("No Content", deleteRes.getStatusMessage()); - - deleteRes.close(); - - final ODataEntityRequest 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); - - changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty(propertyName, - getClient().getPrimitiveValueBuilder().setText(newm).build())); - - update(type, changes, format, etag); - - final ODataEntity actual = read(format, editLink); - - propertyValue = null; - - for (ODataProperty prop : actual.getProperties()) { - if (prop.getName().equals(propertyName)) { - propertyValue = prop; - } - } - - assertNotNull(propertyValue); - assertEquals(newm, propertyValue.getValue().toString()); - } - - protected void update( - final UpdateType type, final ODataEntity changes, final ODataPubFormat format, final String etag) { - final ODataEntityUpdateRequest req = 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()); - } -} 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 3dc766ebe..325f2dd57 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.junit.BeforeClass; +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; -public abstract class AbstractTestITCase extends org.apache.olingo.client.core.it.AbstractTestITCase { +import org.junit.BeforeClass; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class AbstractTestITCase { + + /** + * Logger. + */ + protected static final Logger LOG = LoggerFactory.getLogger(AbstractTestITCase.class); + + protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product"; + + protected static final String servicesODataServiceRootURL = + "http://services.odata.org/V3/(S(csquyjnoaywmz5xcdbfhlc1p))/OData/OData.svc/"; protected static 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()); + } } 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 21d37177a..491a8e1ad 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,26 +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.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.junit.Ignore; +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.Test; public class AsyncTestITCase extends AbstractTestITCase { @@ -68,12 +68,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.getProperty("Description").setValue( - client.getPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()); + + entity.getProperties().remove(entity.getProperty("Description")); + 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); @@ -93,7 +96,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"); @@ -114,7 +116,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()); 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 8146830b5..c6a7c15cc 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 @@ -30,26 +30,26 @@ import java.util.LinkedHashMap; import java.util.Set; import org.apache.http.entity.ContentType; import org.apache.olingo.client.api.communication.header.HeaderName; -import org.apache.olingo.client.api.communication.header.ODataHeaderValues; -import org.apache.olingo.client.api.communication.request.UpdateType; +import org.apache.olingo.client.api.communication.header.ODataPreferences; 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.v3.UpdateType; 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.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.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 org.junit.Ignore; import org.junit.Test; @@ -225,15 +225,15 @@ public class EntityCreateTestITCase extends AbstractTestITCase { @Test public void createReturnNoContent() { final int id = 1; - final ODataEntity 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(ODataHeaderValues.preferReturnNoContent); + createReq.setPrefer(new ODataPreferences(client.getServiceVersion()).returnNoContent()); - final ODataEntityCreateResponse createRes = createReq.execute(); + final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute(); assertEquals(204, createRes.getStatusCode()); - assertEquals(ODataHeaderValues.preferReturnNoContent, + assertEquals(new ODataPreferences(client.getServiceVersion()).returnNoContent(), createRes.getHeader(HeaderName.preferenceApplied).iterator().next()); try { @@ -253,14 +253,14 @@ 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 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()); - createReq.setPrefer(ODataHeaderValues.preferReturnContent); + createReq.setPrefer(new ODataPreferences(client.getServiceVersion()).returnContent()); try { final ODataEntityCreateResponse createRes = createReq.execute(); @@ -280,7 +280,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { throws EdmPrimitiveTypeException { final String sampleName = "Sample customer"; - final ODataEntity original = getSampleCustomerProfile(id, sampleName, false); + final ODataEntity original = (ODataEntity) getSampleCustomerProfile(id, sampleName, false); final Set<Integer> keys = new HashSet<Integer>(); keys.add(-100); @@ -290,30 +290,33 @@ public class EntityCreateTestITCase extends AbstractTestITCase { final ODataEntity order = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order"); - order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId", - client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32) - .build())); - order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId", - client.getPrimitiveValueBuilder().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( + final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest( 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())); } - final ODataEntity 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 ODataEntity 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"); - 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(); @@ -354,7 +357,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { 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(); @@ -382,29 +385,33 @@ public class EntityCreateTestITCase extends AbstractTestITCase { 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.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build())); - order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId", - client.getPrimitiveValueBuilder().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"); 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); - final ODataEntityRequest customerreq = client.getRetrieveRequestFactory().getEntityRequest( + final ODataEntityRequest<ODataEntity> customerreq = client.getRetrieveRequestFactory().getEntityRequest( URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString() + "/Customer")); customerreq.setFormat(format); @@ -413,7 +420,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); @@ -424,7 +431,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); @@ -445,32 +452,38 @@ public class EntityCreateTestITCase extends AbstractTestITCase { final ODataEntity message = client.getObjectFactory().newEntity( "Microsoft.Test.OData.Services.AstoriaDefaultService.Message"); - message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("MessageId", - client.getPrimitiveValueBuilder().setValue(1000). - setType(EdmPrimitiveTypeKind.Int32).build())); - message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FromUsername", - client.getPrimitiveValueBuilder().setValue("1"). - setType(EdmPrimitiveTypeKind.String).build())); - message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("ToUsername", - client.getPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn"). - setType(EdmPrimitiveTypeKind.String).build())); - message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Subject", - client.getPrimitiveValueBuilder().setValue("Test subject"). - setType(EdmPrimitiveTypeKind.String).build())); - message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Body", - client.getPrimitiveValueBuilder().setValue("Test body"). - setType(EdmPrimitiveTypeKind.String).build())); - message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead", - client.getPrimitiveValueBuilder().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"); - 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()); 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 ddcd3421a..1b43c4730 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.format.ODataPubFormat; -import org.apache.olingo.client.api.uri.CommonURIBuilder; -import org.apache.olingo.commons.core.op.ResourceFactory; +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.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.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 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 0a1d503d8..0aaed018b 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 @@ -19,6 +19,7 @@ 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; @@ -28,13 +29,14 @@ 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.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.assertNotNull; import org.junit.Test; /** @@ -90,7 +92,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(); @@ -114,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); @@ -143,7 +146,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); } } 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 129f086a8..223f90872 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,23 @@ */ 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.ODataHeaderValues; -import org.apache.olingo.client.api.communication.request.UpdateType; +import org.apache.olingo.client.api.communication.header.ODataPreferences; 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.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; /** @@ -137,7 +137,7 @@ 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(); @@ -185,9 +185,10 @@ 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). - 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); } @@ -210,11 +211,11 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { @Test public void updateReturnContent() throws EdmPrimitiveTypeException { final ODataEntityUpdateRequest req = buildMultiKeyUpdateReq(client.getConfiguration().getDefaultPubFormat()); - req.setPrefer(ODataHeaderValues.preferReturnContent); + req.setPrefer(new ODataPreferences(client.getServiceVersion()).returnContent()); final ODataEntityUpdateResponse res = req.execute(); assertEquals(200, res.getStatusCode()); - assertEquals(ODataHeaderValues.preferReturnContent, + assertEquals(new ODataPreferences(client.getServiceVersion()).returnContent(), res.getHeader(HeaderName.preferenceApplied).iterator().next()); assertNotNull(res.getBody()); } 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 ed8a776a0..efb818b87 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"); } } @@ -98,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()); } } @@ -117,7 +117,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 { 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 28c354d96..de6808c88 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()); 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 cbcf046cd..44be0fee1 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()); 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 9c2a9f5f6..1b4892d80 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 @@ -18,16 +18,16 @@ */ package org.apache.olingo.client.core.it.v3; -import org.apache.olingo.client.api.communication.request.UpdateType; +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.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 +42,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(); diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java index b56dde693..dbd964f1a 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java @@ -26,9 +26,9 @@ import java.io.IOException; import java.net.URI; import java.util.Collections; import java.util.List; -import org.apache.olingo.client.api.communication.request.UpdateType; import org.apache.olingo.client.api.communication.request.cud.ODataLinkCreateRequest; import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateRequest; +import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType; import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest; import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; 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 33502045a..03bdf00eb 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); } 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 b1e385dc1..000000000 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java +++ /dev/null @@ -1,521 +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.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.edm.EdmPrimitiveTypeException; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; - -import org.junit.Test; - -import org.junit.Ignore; - -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 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 createReq = - client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original); - createReq.setFormat(format); - createReq.setContentType(contentType); - createReq.setPrefer(prefer); - final ODataEntityCreateResponse 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"); - - orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId", - client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32).build())); - orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId", - client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build())); - - final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest( - client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(), - orderEntity); - createReq.setFormat(format); - createReq.setContentType(contentType); - original.addLink(client.getObjectFactory().newFeedNavigationLink( - "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 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 - entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name", - client.getPrimitiveValueBuilder().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)). - setType(EdmPrimitiveTypeKind.Int32).build())); - } - final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue( - "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)"); - - - final ODataComplexValue contactDetails = new ODataComplexValue( - "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails"); - - - final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)"); - altNamesValue.add(client.getPrimitiveValueBuilder(). - 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(). - setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build()); - contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue)); - - final ODataComplexValue contactAliasValue = new ODataComplexValue( - "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(). - setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build()); - contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue)); - - final ODataComplexValue homePhone = new ODataComplexValue( - "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"); - homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber", - client.getPrimitiveValueBuilder().setText("8437568356834568"). - setType(EdmPrimitiveTypeKind.String).build())); - homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension", - client.getPrimitiveValueBuilder().setText("124365426534621534423ttrf"). - setType(EdmPrimitiveTypeKind.String). - build())); - contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone)); - - backupContactInfoValue.add(contactDetails); - entity.getProperties().add(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 ODataEntity inline = ((ODataInlineEntity) link).getEntity(); - if (inline.getEditLink() != null) { - toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString())); - } - } - - if (link instanceof ODataInlineEntitySet) { - final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet(); - for (ODataEntity entity : inline.getEntities()) { - if (entity.getEditLink() != null) { - toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString())); - } - } - } - } - } - assertFalse(toBeDeleted.isEmpty()); - - for (URI link : toBeDeleted) { - final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(link); - final ODataDeleteResponse deleteRes = deleteReq.execute(); - - assertEquals(204, deleteRes.getStatusCode()); - assertEquals("No Content", deleteRes.getStatusMessage()); - - deleteRes.close(); - } - } - // 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); - - entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information", - client.getPrimitiveValueBuilder().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 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 ODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity(); - assertNotNull(originalInline); - - final ODataEntity 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<ODataProperty> original, final Collection<ODataProperty> actual) { - assertTrue(original.size() <= actual.size()); - - final Map<String, ODataProperty> actualProperties = new HashMap<String, ODataProperty>(actual.size()); - - for (ODataProperty prop : actual) { - assertFalse(actualProperties.containsKey(prop.getName())); - actualProperties.put(prop.getName(), prop); - } - - assertTrue(actual.size() <= actualProperties.size()); - - for (ODataProperty prop : original) { - assertNotNull(prop); - if (actualProperties.containsKey(prop.getName())) { - final ODataProperty 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<ODataProperty> originalPropertyValue = new ArrayList<ODataProperty>(); - for (ODataProperty prop : original.asComplex()) { - originalPropertyValue.add(prop); - } - - final List<ODataProperty> actualPropertyValue = new ArrayList<ODataProperty>(); - for (ODataProperty prop : (ODataComplexValue) actual) { - 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()); - } - } -} 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 091d0af80..3a90d70b8 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.client.api.uri.v3.URIBuilder; +import org.apache.olingo.commons.api.domain.CommonODataEntity; import org.apache.olingo.commons.api.domain.ODataComplexValue; -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.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; @@ -62,13 +64,13 @@ public class OpenTypeTestITCase extends AbstractTestITCase { } private ODataEntity readRow(final ODataPubFormat format, final String uuid) { - final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL). + 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) { - 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()); @@ -92,52 +94,73 @@ public class OpenTypeTestITCase extends AbstractTestITCase { final UUID guid = UUID.randomUUID(); 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). - build())); - row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aString", - client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).setValue("string"). - build())); - row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aBoolean", - client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Boolean).setValue(true). - build())); - row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLong", - client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int64).setValue(15L). - build())); - row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDouble", - client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Double).setValue(1.5D). - build())); - row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aByte", - client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE). - build())); - row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDate", - client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()). - build())); + 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.getGeospatialValueBuilder().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.getGeospatialValueBuilder().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.getGeospatialValueBuilder().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.getGeospatialValueBuilder().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); @@ -145,71 +168,78 @@ 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.getGeospatialValueBuilder().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.getGeospatialValueBuilder().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.getGeospatialValueBuilder().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 = - new ODataComplexValue("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails"); + final ODataComplexValue<ODataProperty> 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)); + 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()); @@ -243,7 +273,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()); 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 c6763e98e..56db6fb60 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")); } 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 314e93416..2e495dcd0 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(); 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 28d487f74..0204f78ea 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 @@ -20,13 +20,14 @@ 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.UpdateType; 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.v3.UpdateType; 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.ODataValueRequest; @@ -35,15 +36,16 @@ 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.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.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.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 static org.junit.Assert.assertNotNull; +import org.apache.olingo.commons.api.format.ODataFormat; +import org.apache.olingo.commons.api.format.ODataValueFormat; import org.junit.Test; /** @@ -181,7 +183,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); @@ -206,7 +208,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(); @@ -217,12 +220,12 @@ 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(); - 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(). @@ -250,10 +253,11 @@ 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 retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build()); + ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory(). + getPropertyRequest(uriBuilder.build()); retrieveReq.setFormat(format); ODataRetrieveResponse<ODataProperty> retrieveRes = retrieveReq.execute(); @@ -264,16 +268,16 @@ 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(); - 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 { @@ -301,13 +305,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(); @@ -315,7 +320,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); @@ -344,12 +349,12 @@ public class PropertyTestITCase extends AbstractTestITCase { appendEntitySetSegment("Customer").appendKeySegment(-10).appendPropertySegment("BackupContactInfo"); final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build()); - req.setFormat(format.toString()); + req.setFormat(format.toString(client.getServiceVersion())); final ODataRawResponse res = req.execute(); assertNotNull(res); - final ODataProperty property = res.getBodyAs(ODataProperty.class); + final CommonODataProperty property = res.getBodyAs(CommonODataProperty.class); assertNotNull(property); } } 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 b8dd0a831..02a964dec 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.commons.api.domain.ODataValue; -import org.apache.olingo.commons.api.format.ODataValueFormat; 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 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,22 +96,22 @@ 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()); - ODataEntity entitySet = res.getBody(); - assertNotNull(entitySet); + ODataEntity entity = res.getBody(); + assertNotNull(entity); assertEquals("fi653p3+MklA/LdoBlhWgnMTUUEo8tEgtbMXnF0a3CUNL9BZxXpSRiD9ebTnmNR0zWPjJ" + "VIDx4tdmCnq55XrJh+RW9aI/b34wAogK3kcORw=", - entitySet.getProperties().get(0).getValue().toString()); + entity.getProperties().get(0).getValue().toString()); } @Test(expected = ODataClientErrorException.class) 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(); 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 a3fe55e07..a45da3aa4 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.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.ODataInlineEntitySet; -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.data.Entry; +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.commons.core.data.AtomEntryImpl; +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(); @@ -192,7 +196,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { req.setFormat(ODataPubFormat.ATOM); final Entry atomEntry = - client.getDeserializer().toEntry(req.execute().getRawResponse(), ODataPubFormat.ATOM); + client.getDeserializer().toEntry(req.execute().getRawResponse(), ODataPubFormat.ATOM).getObject(); assertEquals("remotingdestructorprinterswitcheschannelssatellitelanguageresolve", ((AtomEntryImpl) atomEntry).getSummary()); } 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 a74538031..28cb871f2 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; } 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 000000000..962542cc4 --- /dev/null +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java @@ -0,0 +1,82 @@ +/* + * 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.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.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); + + 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); + 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); + } +} 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 new file mode 100644 index 000000000..94e316fa8 --- /dev/null +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java @@ -0,0 +1,288 @@ +/* + * 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 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; +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; +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.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.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.Test; + +/** + * This is the unit test class to check entity retrieve operations. + */ +public class EntityRetrieveTestITCase extends AbstractTestITCase { + + protected String getServiceRoot() { + return testStaticServiceRootURL; + } + + private void withInlineEntry(final ODataPubFormat format) { + final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()). + appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company"); + + final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory(). + getEntityRequest(uriBuilder.build()); + req.setFormat(format); + + final ODataRetrieveResponse<ODataEntity> res = req.execute(); + final CommonODataEntity entity = res.getBody(); + + assertNotNull(entity); + assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getName()); + assertEquals(getServiceRoot() + "/Customers(PersonID=1)", entity.getEditLink().toASCIIString()); + + assertEquals(3, entity.getNavigationLinks().size()); + + 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; + + for (ODataLink link : entity.getNavigationLinks()) { + if (link instanceof ODataInlineEntity) { + final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity(); + assertNotNull(inline); + + final List<? extends CommonODataProperty> properties = inline.getProperties(); + assertEquals(5, properties.size()); + + assertTrue(properties.get(0).getName().equals("CompanyID") + || properties.get(1).getName().equals("CompanyID") + || properties.get(2).getName().equals("CompanyID") + || properties.get(3).getName().equals("CompanyID") + || properties.get(4).getName().equals("CompanyID")); + assertTrue(properties.get(0).getValue().toString().equals("0") + || properties.get(1).getValue().toString().equals("0") + || properties.get(2).getValue().toString().equals("0") + || properties.get(3).getValue().toString().equals("0") + || properties.get(4).getValue().toString().equals("0")); + + found = true; + } + } + + assertTrue(found); + } + + @Test + public void withInlineEntryFromAtom() { + withInlineEntry(ODataPubFormat.ATOM); + } + + @Test + public void withInlineEntryFromJSON() { + // this needs to be full, otherwise there is no mean to recognize links + withInlineEntry(ODataPubFormat.JSON_FULL_METADATA); + } + + private void withInlineFeed(final ODataPubFormat format) { + final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()). + appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders"); + + final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory(). + getEntityRequest(uriBuilder.build()); + req.setFormat(format); + + final ODataRetrieveResponse<ODataEntity> res = req.execute(); + final CommonODataEntity entity = res.getBody(); + assertNotNull(entity); + + boolean found = false; + + for (ODataLink link : entity.getNavigationLinks()) { + if (link instanceof ODataInlineEntitySet) { + final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet(); + assertNotNull(inline); + + found = true; + } + } + + assertTrue(found); + } + + @Test + public void withInlineFeedFromAtom() { + withInlineFeed(ODataPubFormat.ATOM); + } + + @Test + public void withInlineFeedFromJSON() { + // this needs to be full, otherwise there is no mean to recognize links + withInlineFeed(ODataPubFormat.JSON_FULL_METADATA); + } + + private void rawRequest(final ODataPubFormat format) { + final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()). + appendEntitySetSegment("People").appendKeySegment(5); + + final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build()); + req.setFormat(format.toString(client.getServiceVersion())); + + final ODataRawResponse res = req.execute(); + assertNotNull(res); + + final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class); + assertNull(entitySet); + + final ODataEntity entity = res.getBodyAs(ODataEntity.class); + assertTrue(entity.getReference().endsWith("/StaticService/V40/Static.svc/People(5)")); + } + + @Test + public void rawRequestAsAtom() { + rawRequest(ODataPubFormat.ATOM); + } + + @Test + public void rawRequestAsJSON() { + // this needs to be full, otherwise actions will not be provided + rawRequest(ODataPubFormat.JSON_FULL_METADATA); + } + + private void multiKey(final ODataPubFormat format) throws EdmPrimitiveTypeException { + final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>(); + multiKey.put("ProductID", "6"); + multiKey.put("ProductDetailID", 1); + + final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()). + appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey); + + final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + req.setFormat(format); + + final ODataRetrieveResponse<ODataEntity> res = req.execute(); + final CommonODataEntity entity = res.getBody(); + assertNotNull(entity); + assertEquals(Integer.valueOf(1), + entity.getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class)); + } + + @Test + public void multiKeyAsAtom() throws EdmPrimitiveTypeException { + multiKey(ODataPubFormat.ATOM); + } + + @Test + public void multiKeyAsJSON() throws EdmPrimitiveTypeException { + multiKey(ODataPubFormat.JSON_FULL_METADATA); + } + + @Test + public void checkForETagAsATOM() { + checkForETag(ODataPubFormat.ATOM); + } + + @Test + public void checkForETagAsJSON() { + checkForETag(ODataPubFormat.JSON_FULL_METADATA); + } + + private void checkForETag(final ODataPubFormat format) { + final CommonURIBuilder<?> uriBuilder = + client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Orders").appendKeySegment(8); + + final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + req.setFormat(format); + + final ODataRetrieveResponse<ODataEntity> res = req.execute(); + assertEquals(200, res.getStatusCode()); + + final String etag = res.getEtag(); + assertTrue(StringUtils.isNotBlank(etag)); + + final CommonODataEntity order = res.getBody(); + assertEquals(etag, order.getETag()); + } + + @Test(expected = IllegalArgumentException.class) + public void issue99() { + final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Orders"); + + final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + req.setFormat(ODataPubFormat.JSON); + + // this statement should cause an IllegalArgumentException bearing JsonParseException + // since we are attempting to parse an EntitySet as if it was an Entity + req.execute().getBody(); + } + + @Test + public void retrieveEntityViaReferenceAsAtom() { + retrieveEntityViaReference(ODataPubFormat.ATOM); + } + + @Test + public void retrieveEntityViaReferenceAsJSON() { + retrieveEntityViaReference(ODataPubFormat.JSON_FULL_METADATA); + } + + private void retrieveEntityViaReference(final ODataPubFormat format) { + final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()). + appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder"). + appendRefSegment(); + + ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + req.setFormat(format); + + ODataRetrieveResponse<ODataEntity> res = req.execute(); + assertNotNull(res); + + final ODataEntity entity = res.getBody(); + assertNotNull(entity); + assertTrue(entity.getReference().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)")); + + final URI referenceURI = + client.getURIBuilder(getServiceRoot()).appendEntityIdSegment(entity.getReference()).build(); + + req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI); + req.setFormat(format); + + res = req.execute(); + assertNotNull(res); + assertNotNull(res.getBody()); + } +} 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 8455ecdcc..c120415ee 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,8 +18,8 @@ */ 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.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.IOException; @@ -32,10 +32,10 @@ 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.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; /** @@ -53,7 +53,6 @@ public class EntitySetTestITCase extends AbstractTestITCase { } @Test - @Ignore public void rawRequestAsJSON() throws IOException { rawRequest(ODataPubFormat.JSON); } @@ -64,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); } @@ -87,7 +83,6 @@ public class EntitySetTestITCase extends AbstractTestITCase { } @Test - @Ignore public void readODataEntitySetWithNextFromJSON() { readEntitySetWithNextLink(ODataPubFormat.JSON_FULL_METADATA); } @@ -96,16 +91,16 @@ 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); - debugFeed(client.getBinder().getFeed(feed, ResourceFactory.feedClassForFormat( - ODataPubFormat.ATOM == format)), "Just retrieved feed"); + assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People")); assertEquals(5, feed.getEntities().size()); assertNotNull(feed.getNext()); @@ -120,12 +115,12 @@ 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 ODataEntitySetIterator feedIterator = res.getBody(); + final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute(); + final ODataEntitySetIterator<ODataEntitySet, ODataEntity> feedIterator = res.getBody(); assertNotNull(feedIterator); @@ -149,7 +144,8 @@ 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")); } } diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java index 8917c49c0..887a46da3 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java @@ -18,11 +18,16 @@ */ 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.v4.ODataClient; import org.apache.olingo.client.core.ODataClientFactory; import org.apache.olingo.client.core.it.AbstractMetadataTestITCase; import org.apache.olingo.commons.api.edm.Edm; -import static org.junit.Assert.assertNotNull; +import org.apache.olingo.commons.api.edm.EdmEntityContainer; +import org.apache.olingo.commons.api.edm.EdmEntitySet; +import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.junit.Test; public class MetadataTestITCase extends AbstractMetadataTestITCase { @@ -38,4 +43,19 @@ public class MetadataTestITCase extends AbstractMetadataTestITCase { getMetadataRequest(getTestServiceRoot()).execute().getBody(); assertNotNull(metadata); } + + @Test + public void include() { + final Edm metadata = getClient().getRetrieveRequestFactory(). + getMetadataRequest(getNorthwindServiceRoot()).execute().getBody(); + assertNotNull(metadata); + + final EdmEntityContainer container = metadata.getEntityContainer( + new FullQualifiedName("ODataWebExperimental.Northwind.Model", "NorthwindEntities")); + assertNotNull(container); + + final EdmEntitySet categories = container.getEntitySet("Categories"); + assertNotNull(categories); + assertEquals("NorthwindModel", categories.getEntityType().getNamespace()); + } } 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 new file mode 100644 index 000000000..18613cf22 --- /dev/null +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java @@ -0,0 +1,145 @@ +/* + * 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 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.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; +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 { + + @Test + public void retrieveIntPropertyValueTest() throws EdmPrimitiveTypeException { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PersonID"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setFormat(ODataValueFormat.TEXT); + assertEquals("5", req.execute().getBody().toString()); + } + + @Test + public void retrieveBooleanPropertyValueTest() throws EdmPrimitiveTypeException { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("IsRegistered"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setFormat(ODataValueFormat.TEXT); + assertEquals("true", req.execute().getBody().toString()); + } + + @Test + public void retrieveStringPropertyValueTest() throws EdmPrimitiveTypeException { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("FirstName"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setFormat(ODataValueFormat.TEXT); + assertEquals("Peter", req.execute().getBody().toString()); + } + + @Test + public void retrieveDatePropertyValueTest() { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("Orders").appendKeySegment(8).appendPropertySegment("OrderDate"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setFormat(ODataValueFormat.TEXT); + final ODataPrimitiveValue property = req.execute().getBody(); + assertEquals("2011-03-04T16:03:57Z", property.toString()); + } + + @Test + public void retrieveDecimalPropertyValueTest() throws EdmPrimitiveTypeException { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Height"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setFormat(ODataValueFormat.TEXT); + final ODataPrimitiveValue property = req.execute().getBody(); + assertEquals("179", property.toString()); + } + + @Test + public void retrieveBinaryPropertyValueTest() throws IOException { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setFormat(ODataValueFormat.TEXT); + final ODataPrimitiveValue property = req.execute().getBody(); + assertEquals("fi653p3+MklA/LdoBlhWgnMTUUEo8tEgtbMXnF0a3CUNL9BZxXpSRiD9ebTnmNR0zWPjJ" + + "VIDx4tdmCnq55XrJh+RW9aI/b34wAogK3kcORw=", property.toString()); + } + + @Test(expected = ODataClientErrorException.class) + public void retrieveBinaryPropertyValueTestWithAtom() throws IOException { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setAccept(ODataPubFormat.ATOM.toString(ODataServiceVersion.V40)); + req.execute().getBody(); + } + + @Test(expected = ODataClientErrorException.class) + public void retrieveBinaryPropertyValueTestWithXML() throws IOException { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setAccept(ODataFormat.XML.toString(client.getServiceVersion())); + req.execute().getBody(); + } + + @Test + public void retrieveCollectionPropertyValueTest() { + final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers"); + final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory(). + getPropertyRequest(uriBuilder.build()); + req.setFormat(ODataFormat.XML); + final ODataProperty property = req.execute().getBody(); + assertTrue(property.getValue().isCollection()); + assertEquals("555-555-5555", property.getCollectionValue().iterator().next().asPrimitive().toString()); + } + + @Test + public void retrieveNullPropertyValueTest() { + URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("MiddleName"). + appendValueSegment(); + final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); + req.setFormat(ODataValueFormat.TEXT); + final ODataPrimitiveValue property = req.execute().getBody(); + assertTrue(StringUtils.isBlank(property.toString())); + } +} diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java similarity index 54% rename from lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java rename to lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java index f5a9fa9d5..133c92902 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java @@ -16,58 +16,49 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.core.it.v3; +package org.apache.olingo.client.core.it.v4; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; -import static org.junit.Assert.*; import java.net.URI; -import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; 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.Test; -public class ServiceDocumentRetrieveTestITCase extends AbstractTestITCase { +public class ServiceDocumentTestITCase extends AbstractTestITCase { - private void retrieveServiceDocumentTest(final ODataFormat reqFormat, final String acceptFormat) { + private void retrieveServiceDocument(final ODataFormat format) { final ODataServiceDocumentRequest req = client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL); - req.setFormat(reqFormat); - req.setAccept(acceptFormat); + req.setFormat(format); + final ODataRetrieveResponse<ODataServiceDocument> res = req.execute(); assertEquals(200, res.getStatusCode()); + final ODataServiceDocument serviceDocument = res.getBody(); - assertEquals(24, serviceDocument.getEntitySetTitles().size()); - assertEquals(URI.create(testStaticServiceRootURL + "/Customer"), serviceDocument.getEntitySetURI("Customer")); + 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"), + serviceDocument.getEntitySetURI("ProductDetails")); + assertEquals(URI.create(testStaticServiceRootURL + "/Boss"), + serviceDocument.getSingletonURI("Boss")); + assertEquals(URI.create(testStaticServiceRootURL + "/GetPerson"), + serviceDocument.getFunctionImportURI("GetPerson")); } @Test - public void jsonTest() { - retrieveServiceDocumentTest(ODataFormat.JSON, "application/json"); + public void retrieveServiceDocumentAsXML() { + retrieveServiceDocument(ODataFormat.XML); } @Test - public void jsonNoMetadataTest() { - retrieveServiceDocumentTest(ODataFormat.JSON_NO_METADATA, "application/json"); - } - - @Test - public void xmlTest() { - retrieveServiceDocumentTest(ODataFormat.XML, "application/xml"); - } - - @Test(expected = ODataClientErrorException.class) - public void atomAcceptTest() { - retrieveServiceDocumentTest(ODataFormat.XML, "application/atom+xml"); - } - - @Test - public void nullAcceptTest() { - retrieveServiceDocumentTest(ODataFormat.XML, null); - } - - @Test - public void nullServiceFormatTest() { - retrieveServiceDocumentTest(null, "application/xml"); + public void retrieveServiceDocumentAsJSON() { + retrieveServiceDocument(ODataFormat.JSON); } } diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java new file mode 100644 index 000000000..886d1e8bd --- /dev/null +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.client.core.uri; + +import static org.junit.Assert.assertEquals; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.Arrays; +import java.util.Collections; +import org.apache.olingo.client.core.edm.EdmEnumTypeImpl; +import org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl; +import org.apache.olingo.commons.api.Constants; +import org.apache.olingo.commons.api.edm.EdmEnumType; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; +import org.apache.olingo.commons.api.edm.geo.Geospatial; +import org.apache.olingo.commons.api.edm.geo.Point; +import org.junit.Test; + +public class URIEscapeTest { + + @Test + public void _null() { + assertEquals("null", URIUtils.escape(ODataServiceVersion.V40, null)); + } + + @Test + public void _boolean() { + assertEquals("true", URIUtils.escape(ODataServiceVersion.V40, Boolean.TRUE)); + } + + @Test + public void _enum() throws UnsupportedEncodingException { + final EdmEnumType pattern = new EdmEnumTypeImpl(ODataServiceVersion.V40, + null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl()); + + assertEquals(URLEncoder.encode("Sales.Pattern'Yellow'", Constants.UTF8), + URIUtils.escape(ODataServiceVersion.V40, pattern.toUriLiteral("Yellow"))); + } + + @Test + public void geospatial() throws UnsupportedEncodingException { + final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, 0); + point.setX(142.1); + point.setY(64.1); + + assertEquals(URLEncoder.encode("geography'SRID=0;Point(142.1 64.1)'", Constants.UTF8), + URIUtils.escape(ODataServiceVersion.V40, point)); + } + + @Test + public void collection() { + assertEquals("[\"red\",\"green\"]", + URIUtils.escape(ODataServiceVersion.V40, Arrays.asList(new String[] {"red", "green"}))); + } + + @Test + public void complex() { + assertEquals("{\"Name\":\"Value\"}", + URIUtils.escape(ODataServiceVersion.V40, Collections.singletonMap("Name", "Value"))); + } +} diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/FilterFactoryTest.java similarity index 99% rename from lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java rename to lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/FilterFactoryTest.java index 9d7e0a3ca..666edf72a 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/FilterFactoryTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.core.v3; +package org.apache.olingo.client.core.uri.v3; import org.apache.olingo.client.api.v3.ODataClient; import org.apache.olingo.client.api.uri.URIFilter; diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java similarity index 76% rename from lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java rename to lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java index 1838cf8fd..6bfe1165e 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.core.v3; +package org.apache.olingo.client.core.uri.v3; import static org.junit.Assert.assertEquals; @@ -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 { @@ -100,11 +101,23 @@ public class URIBuilderTest extends AbstractTest { uriBuilder.build()); } + @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", - Collections.<String, Object>singletonMap("categoryId", 2)); + Collections.<String, Object>singletonMap("categoryId", 2)); assertEquals(new org.apache.http.client.utils.URIBuilder( SERVICE_ROOT + "/ProductsByCategoryId(categoryId=2)").build(), uriBuilder.build()); @@ -128,4 +141,22 @@ public class URIBuilderTest extends AbstractTest { assertEquals(new org.apache.http.client.utils.URIBuilder( SERVICE_ROOT + "/Customers/Model/Namespace.VipCustomer(1)").build(), uriBuilder.build()); } + + @Test + public void expandMoreThenOnce() throws URISyntaxException { + URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5). + expand("Orders", "Customers").expand("Info").build(); + + assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)"). + addParameter("$expand", "Orders,Customers,Info").build(), uri); + } + + @Test + public void selectMoreThenOnce() throws URISyntaxException { + URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Customers").appendKeySegment(5). + select("Name", "Surname").expand("Info").select("Gender").build(); + + assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customers(5)"). + addParameter("$select", "Name,Surname,Gender").addParameter("$expand", "Info").build(), uri); + } } diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java similarity index 98% rename from lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java rename to lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java index fd2a69694..06a07e6b7 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.core.v4; +package org.apache.olingo.client.core.uri.v4; import org.apache.olingo.client.api.v4.ODataClient; import org.apache.olingo.client.api.uri.URIFilter; diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java similarity index 87% rename from lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java rename to lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java index 868b363c8..af26059e0 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java @@ -16,10 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.core.v4; +package org.apache.olingo.client.core.uri.v4; import java.net.URI; import java.net.URISyntaxException; +import java.util.LinkedHashMap; import org.apache.olingo.client.api.v4.ODataClient; import org.apache.olingo.client.api.uri.v4.URIBuilder; @@ -38,6 +39,22 @@ public class URIBuilderTest extends AbstractTest { return v4Client; } + @Test + public void expandWithOptions() throws URISyntaxException { + URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5). + expandWithOptions("ProductDetails", new LinkedHashMap<String, Object>() { + private static final long serialVersionUID = 3109256773218160485L; + + { + put("$expand", "ProductInfo"); + put("$select", "Price"); + } + }).expand("Orders", "Customers").build(); + + assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)"). + addParameter("$expand", "ProductDetails($expand=ProductInfo,$select=Price),Orders,Customers").build(), uri); + } + @Test public void count() throws URISyntaxException { URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build(); @@ -132,5 +149,4 @@ public class URIBuilderTest extends AbstractTest { assertEquals(new org.apache.http.client.utils.URIBuilder( SERVICE_ROOT + "/Products").addParameter("$search", "blue OR green").build(), uriBuilder.build()); } - } diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java index 755b44b59..ce2ef71b4 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java @@ -53,7 +53,7 @@ public class AtomTest extends AbstractTest { private String cleanup(final String input) throws Exception { final TransformerFactory factory = TransformerFactory.newInstance(); - final Source xslt = new StreamSource(getClass().getResourceAsStream("../atom_cleanup.xsl")); + final Source xslt = new StreamSource(getClass().getResourceAsStream("atom_cleanup.xsl")); final Transformer transformer = factory.newTransformer(xslt); final StringWriter result = new StringWriter(); @@ -70,8 +70,7 @@ public class AtomTest extends AbstractTest { protected void feed(final String filename, final ODataPubFormat format) throws Exception { final StringWriter writer = new StringWriter(); getClient().getSerializer().feed(getClient().getDeserializer().toFeed( - getClass().getResourceAsStream("Customer." + getSuffix(format)), format), - writer); + getClass().getResourceAsStream("Customer." + getSuffix(format)), format).getObject(), writer); assertSimilar("Customer." + getSuffix(format), writer.toString()); } @@ -84,7 +83,7 @@ public class AtomTest extends AbstractTest { protected void entry(final String filename, final ODataPubFormat format) throws Exception { final StringWriter writer = new StringWriter(); getClient().getSerializer().entry(getClient().getDeserializer().toEntry( - getClass().getResourceAsStream(filename + "." + getSuffix(format)), format), writer); + getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer); assertSimilar(filename + "." + getSuffix(format), writer.toString()); } @@ -104,7 +103,7 @@ public class AtomTest extends AbstractTest { protected void property(final String filename, final ODataFormat format) throws Exception { final StringWriter writer = new StringWriter(); getClient().getSerializer().property(getClient().getDeserializer(). - toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format), writer); + toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer); assertSimilar(filename + "." + getSuffix(format), writer.toString()); } @@ -128,5 +127,4 @@ public class AtomTest extends AbstractTest { property("Product_-10_ComplexConcurrency_QueriedDateTime", getODataFormat()); property("Product_-10_Dimensions_Width", getODataFormat()); } - } 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 c6fd0d8df..0400321d2 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,9 +24,10 @@ 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.api.domain.v3.ODataEntitySet; import org.apache.olingo.commons.core.op.ResourceFactory; import org.junit.Test; @@ -40,13 +41,13 @@ 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( - getClient().getDeserializer().toFeed(input, format)); + 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); } 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 b61598864..99b9423eb 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,11 +24,12 @@ 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.ODataLink; -import org.apache.olingo.commons.api.domain.ODataProperty; 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; import org.apache.olingo.commons.api.edm.geo.Geospatial; @@ -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 ODataEntity entity = getClient().getBinder().getODataEntity( - getClient().getDeserializer().toEntry(input, format)); + getClient().getDeserializer().toEntry(input, format).getObject()); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer", entity.getName()); @@ -81,15 +82,15 @@ 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( - getClient().getDeserializer().toEntry(input, format)); + getClient().getDeserializer().toEntry(input, format).getObject()); assertNotNull(entity); boolean found = false; for (ODataProperty property : entity.getProperties()) { if ("GeogMultiLine".equals(property.getName())) { found = true; - assertTrue(property.hasGeospatialValue()); - assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString, property.getGeospatialValue().getTypeKind()); + assertTrue(property.hasPrimitiveValue()); + assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString, property.getPrimitiveValue().getTypeKind()); } } assertTrue(found); @@ -113,7 +114,7 @@ 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( - getClient().getDeserializer().toEntry(input, format)); + getClient().getDeserializer().toEntry(input, format).getObject()); assertNotNull(entity); assertEquals(1, entity.getOperations().size()); @@ -139,7 +140,7 @@ 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( - getClient().getDeserializer().toEntry(input, format)); + getClient().getDeserializer().toEntry(input, format).getObject()); assertNotNull(entity); assertTrue(entity.isMediaEntity()); assertNotNull(entity.getMediaContentSource()); @@ -160,30 +161,30 @@ public class EntityTest extends AbstractTest { mediaEntity(ODataPubFormat.JSON_FULL_METADATA); } - private void issue128(final ODataPubFormat format) { + private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException { final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format)); final ODataEntity entity = getClient().getBinder().getODataEntity( - getClient().getDeserializer().toEntry(input, format)); + getClient().getDeserializer().toEntry(input, format).getObject()); assertNotNull(entity); final ODataProperty geogCollection = entity.getProperty("GeogCollection"); - assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getGeospatialValue().getTypeKind()); + assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getPrimitiveValue().getTypeKind()); int count = 0; - for (Geospatial g : geogCollection.getGeospatialValue().toCastValue(GeospatialCollection.class)) { - assertNotNull(g); + for (Geospatial geo : geogCollection.getPrimitiveValue().toCastValue(GeospatialCollection.class)) { + assertNotNull(geo); count++; } assertEquals(2, count); } @Test - public void issue128FromAtom() { + public void issue128FromAtom() throws EdmPrimitiveTypeException { issue128(ODataPubFormat.ATOM); } @Test - public void issue128FromJSON() { + public void issue128FromJSON() throws EdmPrimitiveTypeException { issue128(ODataPubFormat.JSON_FULL_METADATA); } } 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 0b10d51c5..b2cf8e372 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 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 c3b155248..64badc0ce 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; @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; import org.apache.commons.io.IOUtils; import org.apache.olingo.commons.api.Constants; +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; @@ -48,34 +49,42 @@ public class JSONTest extends AtomTest { } private void cleanup(final ObjectNode node) { - if (node.has(Constants.JSON_TYPE)) { - node.remove(Constants.JSON_TYPE); + if (node.has(Constants.JSON_METADATA)) { + node.remove(Constants.JSON_METADATA); } - if (node.has(Constants.JSON_EDIT_LINK)) { - node.remove(Constants.JSON_EDIT_LINK); + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE)); } - if (node.has(Constants.JSON_READ_LINK)) { - node.remove(Constants.JSON_READ_LINK); + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK)); } - if (node.has(Constants.JSON_MEDIAEDIT_LINK)) { - node.remove(Constants.JSON_MEDIAEDIT_LINK); + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_READ_LINK))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_READ_LINK)); } - if (node.has(Constants.JSON_MEDIAREAD_LINK)) { - node.remove(Constants.JSON_MEDIAREAD_LINK); + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_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_MEDIAREAD_LINK))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK)); + } + 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();) { final Map.Entry<String, JsonNode> field = itor.next(); if (field.getKey().charAt(0) == '#' - || field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX) - || field.getKey().endsWith(Constants.JSON_MEDIAEDIT_LINK_SUFFIX) - || field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX) - || field.getKey().endsWith(Constants.JSON_ASSOCIATION_LINK_SUFFIX) - || field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) { + || field.getKey().endsWith( + getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE)) + || field.getKey().endsWith( + getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK)) + || 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( + getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) { toRemove.add(field.getKey()); } else if (field.getValue().isObject()) { @@ -95,10 +104,12 @@ public class JSONTest extends AtomTest { @Override protected void assertSimilar(final String filename, final String actual) throws Exception { final JsonNode orig = OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream(filename)). - replace("Categories" + Constants.JSON_NAVIGATION_LINK_SUFFIX, + replace("Categories" + getClient().getServiceVersion().getJSONMap(). + get(ODataServiceVersion.JSON_NAVIGATION_LINK), "Categories" + Constants.JSON_BIND_LINK_SUFFIX). replace("\"Products(0)/Categories\"", "[\"Products(0)/Categories\"]"). - replace(Constants.JSON_NAVIGATION_LINK_SUFFIX, Constants.JSON_BIND_LINK_SUFFIX)); + replace(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK), + Constants.JSON_BIND_LINK_SUFFIX)); cleanup((ObjectNode) orig); assertEquals(orig, OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes()))); } diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java index 5dca101b7..a4d1ba8aa 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java @@ -134,7 +134,7 @@ public class MetadataTest extends AbstractTest { new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService", "ProductReview")); assertNotNull(entity); assertFalse(entity.getPropertyNames().isEmpty()); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32), + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32), entity.getProperty("ProductId").getType()); assertFalse(entity.getKeyPropertyRefs().isEmpty()); @@ -178,7 +178,7 @@ public class MetadataTest extends AbstractTest { final EdmFunctionImport getArgumentPlusOne = container.getFunctionImport("GetArgumentPlusOne"); assertNotNull(getArgumentPlusOne); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32), + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32), getArgumentPlusOne.getFunction(null).getReturnType().getType()); final EdmActionImport resetDataSource = container.getActionImport("ResetDataSource"); 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 e3cbd7ec6..64301dfa3 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 @@ -20,7 +20,6 @@ package org.apache.olingo.client.core.v3; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.math.BigDecimal; import java.sql.Timestamp; @@ -58,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()); } @@ -83,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()); } @@ -100,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()); @@ -124,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 @@ -138,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()); @@ -156,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()); } @@ -169,45 +169,38 @@ 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))); } @Test - public void managePoint() { + public void managePoint() throws EdmPrimitiveTypeException { final Point primitive = new Point(Geospatial.Dimension.GEOGRAPHY, null); primitive.setX(52.8606); primitive.setY(173.334); - try { - getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint). - setValue(primitive).build(); - fail(); - } catch (IllegalArgumentException iae) { - // nothing top do - } - - final ODataValue value = - getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint). + final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + setType(EdmPrimitiveTypeKind.GeographyPoint). setValue(primitive). build(); - assertEquals(EdmPrimitiveTypeKind.GeographyPoint, value.asGeospatial().getTypeKind()); + assertEquals(EdmPrimitiveTypeKind.GeographyPoint, value.asPrimitive().getTypeKind()); assertEquals(Double.valueOf(primitive.getX()), - Double.valueOf(value.asGeospatial().toCastValue(Point.class).getX())); + Double.valueOf(value.asPrimitive().toCastValue(Point.class).getX())); assertEquals(Double.valueOf(primitive.getY()), - Double.valueOf(value.asGeospatial().toCastValue(Point.class).getY())); + Double.valueOf(value.asPrimitive().toCastValue(Point.class).getY())); } @Test - public void manageLineString() { + public void manageLineString() throws EdmPrimitiveTypeException { final List<Point> points = new ArrayList<Point>(); Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null); point.setX(40.5); @@ -231,11 +224,12 @@ public class PrimitiveValueTest extends AbstractTest { final LineString primitive = new LineString(Geospatial.Dimension.GEOGRAPHY, null, points); - final ODataValue value = getClient().getGeospatialValueBuilder(). - setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build(); - assertEquals(EdmPrimitiveTypeKind.GeographyLineString, value.asGeospatial().getTypeKind()); + final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + setType(EdmPrimitiveTypeKind.GeographyLineString). + setValue(primitive).build(); + assertEquals(EdmPrimitiveTypeKind.GeographyLineString, value.asPrimitive().getTypeKind()); - final Iterator<Point> iter = value.asGeospatial().toCastValue(LineString.class).iterator(); + final Iterator<Point> iter = value.asPrimitive().toCastValue(LineString.class).iterator(); // take the third one and check the point value ... iter.next(); @@ -247,7 +241,7 @@ public class PrimitiveValueTest extends AbstractTest { } @Test - public void manageMultiPoint() { + public void manageMultiPoint() throws EdmPrimitiveTypeException { final List<Point> points = new ArrayList<Point>(); Point point = new Point(Geospatial.Dimension.GEOMETRY, null); point.setX(0); @@ -256,11 +250,12 @@ public class PrimitiveValueTest extends AbstractTest { final MultiPoint primitive = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points); - final ODataValue value = getClient().getGeospatialValueBuilder(). - setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build(); - assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint, value.asGeospatial().getTypeKind()); + final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + setType(EdmPrimitiveTypeKind.GeometryMultiPoint). + setValue(primitive).build(); + assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint, value.asPrimitive().getTypeKind()); - final Iterator<Point> iter = value.asGeospatial().toCastValue(MultiPoint.class).iterator(); + final Iterator<Point> iter = value.asPrimitive().toCastValue(MultiPoint.class).iterator(); point = iter.next(); assertEquals(Double.valueOf(points.get(0).getX()), Double.valueOf(point.getX())); @@ -268,7 +263,7 @@ public class PrimitiveValueTest extends AbstractTest { } @Test - public void manageMultiLine() { + public void manageMultiLine() throws EdmPrimitiveTypeException { final List<LineString> lines = new ArrayList<LineString>(); // line one ... @@ -316,12 +311,12 @@ public class PrimitiveValueTest extends AbstractTest { final MultiLineString primitive = new MultiLineString(Geospatial.Dimension.GEOMETRY, null, lines); - final ODataValue value = - getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString). + final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + setType(EdmPrimitiveTypeKind.GeometryMultiLineString). setValue(primitive).build(); - assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString, value.asGeospatial().getTypeKind()); + assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString, value.asPrimitive().getTypeKind()); - final Iterator<LineString> lineIter = value.asGeospatial().toCastValue(MultiLineString.class).iterator(); + final Iterator<LineString> lineIter = value.asPrimitive().toCastValue(MultiLineString.class).iterator(); // take the second line and check the third point value ... lineIter.next(); @@ -337,7 +332,7 @@ public class PrimitiveValueTest extends AbstractTest { } @Test - public void managePolygon() { + public void managePolygon() throws EdmPrimitiveTypeException { final List<Point> interior = new ArrayList<Point>(); final List<Point> exterior = new ArrayList<Point>(); @@ -369,13 +364,13 @@ public class PrimitiveValueTest extends AbstractTest { final Polygon primitive = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, interior, exterior); - final ODataValue value = - getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon). + final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + setType(EdmPrimitiveTypeKind.GeographyPolygon). setValue(primitive).build(); - assertEquals(EdmPrimitiveTypeKind.GeographyPolygon, value.asGeospatial().getTypeKind()); + assertEquals(EdmPrimitiveTypeKind.GeographyPolygon, value.asPrimitive().getTypeKind()); - assertTrue(value.asGeospatial().toCastValue(Polygon.class).getInterior().isEmpty()); - final Iterator<Point> iter = value.asGeospatial().toCastValue(Polygon.class).getExterior().iterator(); + assertTrue(value.asPrimitive().toCastValue(Polygon.class).getInterior().isEmpty()); + final Iterator<Point> iter = value.asPrimitive().toCastValue(Polygon.class).getExterior().iterator(); // take the third one ... iter.next(); @@ -387,7 +382,7 @@ public class PrimitiveValueTest extends AbstractTest { } @Test - public void manageMultiPolygon() { + public void manageMultiPolygon() throws EdmPrimitiveTypeException { final List<Polygon> polygons = new ArrayList<Polygon>(); List<Point> interior = new ArrayList<Point>(); @@ -475,12 +470,12 @@ public class PrimitiveValueTest extends AbstractTest { final MultiPolygon primitive = new MultiPolygon(Geospatial.Dimension.GEOMETRY, null, polygons); - final ODataValue value = - getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon). + final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + setType(EdmPrimitiveTypeKind.GeometryMultiPolygon). setValue(primitive).build(); - assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon, value.asGeospatial().getTypeKind()); + assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon, value.asPrimitive().getTypeKind()); - final Iterator<Polygon> iter = value.asGeospatial().toCastValue(MultiPolygon.class).iterator(); + final Iterator<Polygon> iter = value.asPrimitive().toCastValue(MultiPolygon.class).iterator(); // second one polygon iter.next(); @@ -504,7 +499,7 @@ public class PrimitiveValueTest extends AbstractTest { } @Test - public void manageGeomCollection() { + public void manageGeomCollection() throws EdmPrimitiveTypeException { final List<Geospatial> collection = new ArrayList<Geospatial>(); Point point = new Point(Geospatial.Dimension.GEOMETRY, null); @@ -521,12 +516,12 @@ public class PrimitiveValueTest extends AbstractTest { final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOMETRY, null, collection); - final ODataValue value = - getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection). + final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + setType(EdmPrimitiveTypeKind.GeometryCollection). setValue(primitive).build(); - assertEquals(EdmPrimitiveTypeKind.GeometryCollection, value.asGeospatial().getTypeKind()); + assertEquals(EdmPrimitiveTypeKind.GeometryCollection, value.asPrimitive().getTypeKind()); - final Iterator<Geospatial> iter = value.asGeospatial().toCastValue(GeospatialCollection.class).iterator(); + final Iterator<Geospatial> iter = value.asPrimitive().toCastValue(GeospatialCollection.class).iterator(); iter.next(); final Point collectedPoint = (Point) iter.next(); @@ -536,7 +531,7 @@ public class PrimitiveValueTest extends AbstractTest { } @Test - public void manageGeogCollection() { + public void manageGeogCollection() throws EdmPrimitiveTypeException { final List<Geospatial> collection = new ArrayList<Geospatial>(); Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null); @@ -553,12 +548,12 @@ public class PrimitiveValueTest extends AbstractTest { final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, collection); - final ODataValue value = - getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection). + final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + setType(EdmPrimitiveTypeKind.GeographyCollection). setValue(primitive).build(); - assertEquals(EdmPrimitiveTypeKind.GeographyCollection, value.asGeospatial().getTypeKind()); + assertEquals(EdmPrimitiveTypeKind.GeographyCollection, value.asPrimitive().getTypeKind()); - final Iterator<Geospatial> iter = value.asGeospatial().toCastValue(GeospatialCollection.class).iterator(); + final Iterator<Geospatial> iter = value.asPrimitive().toCastValue(GeospatialCollection.class).iterator(); iter.next(); final Point collectedPoint = (Point) iter.next(); diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java similarity index 56% rename from lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java rename to lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java index 37f2688cd..317d1ac0d 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java @@ -16,43 +16,41 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.core; +package org.apache.olingo.client.core.v3; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import org.apache.commons.io.IOUtils; +import org.apache.olingo.client.api.v3.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.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; 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.edm.constants.ODataServiceVersion; +import org.apache.olingo.commons.api.format.ODataFormat; + import org.junit.Test; -public abstract class AbstractPropertyTest extends AbstractTest { +public class PropertyTest extends AbstractTest { - protected abstract ODataFormat getFormat(); - - protected ODataServiceVersion getVersion() { - return getClient().getServiceVersion(); + @Override + protected ODataClient getClient() { + return v3Client; } @Test public void readPropertyValue() throws IOException { - final InputStream input = getClass().getResourceAsStream( - getVersion().name().toLowerCase() + File.separatorChar - + "Customer_-10_CustomerId_value.txt"); + 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(); @@ -60,23 +58,21 @@ public abstract class AbstractPropertyTest extends AbstractTest { assertEquals("-10", value.toString()); } - private ODataProperty primitive() throws IOException, EdmPrimitiveTypeException { - final InputStream input = getClass().getResourceAsStream( - getVersion().name().toLowerCase() + File.separatorChar - + "Customer_-10_CustomerId." + getSuffix(getFormat())); - final ODataProperty property = getClient().getReader().readProperty(input, getFormat()); + 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); assertTrue(property.hasPrimitiveValue()); assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class)); ODataProperty comparable; final ODataProperty written = getClient().getReader().readProperty( - getClient().getWriter().writeProperty(property, getFormat()), getFormat()); - if (getFormat() == ODataFormat.XML) { + 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 ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder(). + final ODataPrimitiveValue typedValue = getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(property.getPrimitiveValue().getTypeKind()). setText(written.getPrimitiveValue().toString()). build(); @@ -84,32 +80,34 @@ public abstract class AbstractPropertyTest extends AbstractTest { } assertEquals(property, comparable); - - return property; } @Test - public void readPrimitiveProperty() throws IOException, EdmPrimitiveTypeException { - primitive(); + public void xmlPrimitive() throws IOException, EdmPrimitiveTypeException { + primitive(ODataFormat.XML); } - private ODataProperty complex() throws IOException { - final InputStream input = getClass().getResourceAsStream( - getVersion().name().toLowerCase() + File.separatorChar - + "Customer_-10_PrimaryContactInfo." + getSuffix(getFormat())); - final ODataProperty property = getClient().getReader().readProperty(input, getFormat()); + @Test + public void jsonPrimitive() throws IOException, EdmPrimitiveTypeException { + primitive(ODataFormat.JSON); + } + + 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); assertTrue(property.hasComplexValue()); assertEquals(6, property.getComplexValue().size()); ODataProperty comparable; final ODataProperty written = getClient().getReader().readProperty( - getClient().getWriter().writeProperty(property, getFormat()), getFormat()); - if (getFormat() == ODataFormat.XML) { + 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 = new ODataComplexValue(property.getComplexValue().getType()); + 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); @@ -118,58 +116,51 @@ public abstract class AbstractPropertyTest extends AbstractTest { } assertEquals(property, comparable); - - return property; } @Test - public void readComplexProperty() throws IOException { - complex(); + public void xmlComplex() throws IOException { + complex(ODataFormat.XML); } - private ODataProperty collection() throws IOException { - final InputStream input = getClass().getResourceAsStream( - getVersion().name().toLowerCase() + File.separatorChar - + "Customer_-10_BackupContactInfo." + getSuffix(getFormat())); - final ODataProperty property = getClient().getReader().readProperty(input, getFormat()); + @Test + public void jsonComplex() throws IOException { + complex(ODataFormat.JSON); + } + + 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); assertTrue(property.hasCollectionValue()); assertEquals(9, property.getCollectionValue().size()); ODataProperty comparable; final ODataProperty written = getClient().getReader().readProperty( - getClient().getWriter().writeProperty(property, getFormat()), getFormat()); - if (getFormat() == ODataFormat.XML) { + 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 = - new ODataCollectionValue(property.getCollectionValue().getType()); + 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(); - if (value.isPrimitive()) { - typedValue.add(value); - } - if (value.isComplex()) { - final ODataComplexValue typedComplexValue = - new ODataComplexValue("Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails"); - for (final Iterator<ODataProperty> valueItor = value.asComplex().iterator(); valueItor.hasNext();) { - final ODataProperty prop = valueItor.next(); - typedComplexValue.add(prop); - } - typedValue.add(typedComplexValue); - } + typedValue.add(value); } comparable = getClient().getObjectFactory().newCollectionProperty(written.getName(), typedValue); } assertEquals(property, comparable); - - return property; } @Test - public void readCollectionProperty() throws IOException { - collection(); + public void xmlCollection() throws IOException { + collection(ODataFormat.XML); + } + + @Test + public void jsonCollection() throws IOException { + collection(ODataFormat.JSON); } } diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java new file mode 100644 index 000000000..ed6b8c089 --- /dev/null +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java @@ -0,0 +1,74 @@ +/* + * 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.ByteArrayInputStream; +import java.io.StringWriter; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import org.apache.commons.io.IOUtils; +import org.apache.olingo.client.api.v4.ODataClient; +import org.apache.olingo.client.core.AtomLinksQualifier; +import org.apache.olingo.commons.api.format.ODataFormat; +import org.apache.olingo.commons.api.format.ODataPubFormat; +import org.custommonkey.xmlunit.Diff; +import static org.junit.Assert.assertTrue; + +public class AtomTest extends JSONTest { + + @Override + protected ODataClient getClient() { + return v4Client; + } + + @Override + protected ODataPubFormat getODataPubFormat() { + return ODataPubFormat.ATOM; + } + + @Override + protected ODataFormat getODataFormat() { + return ODataFormat.XML; + } + + private String cleanup(final String input) throws Exception { + final TransformerFactory factory = TransformerFactory.newInstance(); + final Source xslt = new StreamSource(getClass().getResourceAsStream("atom_cleanup.xsl")); + final Transformer transformer = factory.newTransformer(xslt); + + final StringWriter result = new StringWriter(); + transformer.transform(new StreamSource(new ByteArrayInputStream(input.getBytes())), new StreamResult(result)); + return result.toString(); + } + + protected void assertSimilar(final String filename, final String actual) throws Exception { + final Diff diff = new Diff(cleanup(IOUtils.toString(getClass().getResourceAsStream(filename))), actual); + diff.overrideElementQualifier(new AtomLinksQualifier()); + assertTrue(diff.similar()); + } + + @Override + public void additionalEntries() throws Exception { + // no test + } + +} 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 000000000..cbca94254 --- /dev/null +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.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.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.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; + +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 ODataEntitySet 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); + } + + 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); + } +} 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 000000000..5b8f586a9 --- /dev/null +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java @@ -0,0 +1,250 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.client.core.v4; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.InputStream; +import java.util.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; +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; +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); + + 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(). + 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); + } + + 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); + } + + 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); + } +} 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 000000000..c89fa3934 --- /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); + } + +} 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 new file mode 100644 index 000000000..791c1c77f --- /dev/null +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java @@ -0,0 +1,173 @@ +/* + * 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 com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.ByteArrayInputStream; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import org.apache.commons.io.IOUtils; +import org.apache.olingo.client.api.v4.ODataClient; +import org.apache.olingo.client.core.AbstractTest; +import org.apache.olingo.commons.api.Constants; +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 static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class JSONTest extends AbstractTest { + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + @Override + protected ODataClient getClient() { + return v4Client; + } + + protected ODataPubFormat getODataPubFormat() { + return ODataPubFormat.JSON; + } + + protected ODataFormat getODataFormat() { + return ODataFormat.JSON; + } + + private void cleanup(final ObjectNode node) { + if (node.has(Constants.JSON_CONTEXT)) { + node.remove(Constants.JSON_CONTEXT); + } + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE)); + } + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK)); + } + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_READ_LINK))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_READ_LINK)); + } + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK)); + } + if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) { + node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK)); + } + 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();) { + final Map.Entry<String, JsonNode> field = itor.next(); + + if (field.getKey().charAt(0) == '#' + || field.getKey().endsWith( + getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE)) + || field.getKey().endsWith( + getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK)) + || 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( + getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) { + + toRemove.add(field.getKey()); + } else if (field.getValue().isObject()) { + cleanup((ObjectNode) field.getValue()); + } else if (field.getValue().isArray()) { + for (final Iterator<JsonNode> arrayItems = field.getValue().elements(); arrayItems.hasNext();) { + final JsonNode arrayItem = arrayItems.next(); + if (arrayItem.isObject()) { + cleanup((ObjectNode) arrayItem); + } + } + } + } + node.remove(toRemove); + } + + protected void assertSimilar(final String filename, final String actual) throws Exception { + final JsonNode orig = OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream(filename)). + replace(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK), + Constants.JSON_BIND_LINK_SUFFIX)); + cleanup((ObjectNode) orig); + 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( + getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer); + + assertSimilar(filename + "." + getSuffix(format), writer.toString()); + } + + @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()); + entry("entity.collection.complex", getODataPubFormat()); + } + + @Test + 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 { + final StringWriter writer = new StringWriter(); + getClient().getSerializer().property(getClient().getDeserializer(). + toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer); + + assertSimilar(filename + "." + getSuffix(format), writer.toString()); + } + + @Test + public void properties() throws Exception { + property("Products_5_SkinColor", getODataFormat()); + property("Products_5_CoverColors", getODataFormat()); + property("Employees_3_HomeAddress", getODataFormat()); + property("Employees_3_HomeAddress", getODataFormat()); + } +} diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java index fb2ba5ca7..b594858e5 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java @@ -83,7 +83,7 @@ public class MetadataTest extends AbstractTest { assertNotNull(responseStatus); assertTrue(responseStatus.getNavigationPropertyNames().isEmpty()); assertEquals("Recipient", responseStatus.getBaseType().getName()); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset), + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset), responseStatus.getProperty("Time").getType()); // 3. Entity @@ -107,7 +107,7 @@ public class MetadataTest extends AbstractTest { assertNotNull(move); assertTrue(move.isBound()); assertEquals(2, move.getParameterNames().size()); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), move.getParameter("DestinationId").getType()); // 5. EntityContainer @@ -279,5 +279,4 @@ public class MetadataTest extends AbstractTest { readMetadata(getClass().getResourceAsStream("fromdoc3-metadata.xml")); assertNotNull(metadata); } - } 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 0fc9b18ac..e61a9df9f 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()); 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 000000000..022496c8b --- /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); + } +} 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 4dc4faec0..08067abfe 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()); } } diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json index 1397899ae..f83ef33e6 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json @@ -1 +1,218 @@ -{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)","value":[{"EmailBag":[],"AlternativeNames":["\u307e\u30df\u30dc\u3042\u5f0c\u30df\u3093\uff66\u3092\u30df\u30b0\u30df\u3092\uff5a\u30bd\u30dc\u30bd\u30dd\u30bf\uff5a\u3079\u88f9\u30bf\u755a\u30b0\u3041\u66a6\u307e\u305f\u88f9\u4e5d\u307d\u30de\u305d\u4e5d\u307d\u6b79\u30bc\u4e5d\u30de\u30bd\u305f\u305d\u30de\u042f\u307d\u305c\u30bc\u30bc\u66a6\u30cf\u30cf\u30d0\u73f1\u30c0\u30b0\u3074\u4e9c\u30de\u30df\uff41\u044f\u6b32\u30bc\uff66\u305c\u042f\u3074\u3074\u3072\u5f0c\u0451\u9ed1\u6b79\u30be\u3042","\u305c\uff66\u30b0\u755a\u30a1\u3092\u305f\u30dd\u73f1\u30c1\u30b0\u3042\u3042\u30df\u042f\u4e9c\u30bc\u30a1\u30df\u30df\u9ed1\u307d\u88f9\u307a\u307c\u042f\u30c0\u30de\u531a\u30a1\u30be\u30cf\u30a1\u88f9\u30cf\u531a\u30c0\u305f\u30be\u305c\u66a6\u30bd\u3072\u30dc\u6b32\u305b\u30df\u3093\u9ed1\u3042\u3042\u4e5d\u305b\u305d\uff5a\u6b79\u3041\u305f\u30dc\u30a1\u4e5d\u30bd\u7e37\u30be\u305b\u5f0c\u30df\u3073\u305e\u307a\u3079\u307d\u73f1\u30d0\u9ed1\u30bd\u305d\u307e\u30bc\u3072\u3092\u307b\u4e9c\u30de\u307d\u30df\u30be"],"ContactAlias":{"AlternativeNames":["uhgnrnahnbsyvzlbltutlemsbcgdlchlxtsdpzkthvueixlxaelaq","pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp","eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi","\u0451\u042f\u30dd\u305e\u30df\u66a6\u4e9c\u30bf\u30a1\u305c\u73f1\u042f\u30bc\u7e37\u30df\u30dc\u305c\u30dd\u30cf\u307a\u30d0\u307e\u30dd\u3074\u305f\u30be\u30bd\u30c1\u30c1\u30a1\u30dd\u307e\u755a\u3072\uff88\uff88\u30af\uff9d\u30bf\u305b\u30be\u30bd\u30dd\u3042\u30bc\u305c\u0451\u4e5d\uff88\u3079\u307d\u30bc\u3041\u30cf\u307e\u4e5d\u30a1\u30bd\uff9d\u307c\u30af\u3079\uff66\u042f\u30bc\u30c1\u305e\u307d\u9ed1\u4e5d\u307d\u305d\u305e\u30be\u30df\u305e\u30dc\u30d0\u5f0c\u3041\u30bd\u30de\u30c1\u30af\u3042\u307c\u307b\u307e\u755a","adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukr\u00df\u00df\u00dfirygjzsssktizcikerysklohuonekujmutsxuvdbacrj","uahsvudml\u00dfdtbxxm","yulcdchqqcvrrmzhaeens","vxiefursgkqzptijhincpdm"]},"HomePhone":{"PhoneNumber":"jlessdhjbgglmofcy\u00dfuc\u00dfqbrf\u00dfppgzvygdyss\u00dfpehkrdetitm\u00dffddsplccvussrvidmkodchdfzjvfgossbciq","Extension":null},"WorkPhone":{"PhoneNumber":"\u30df\u3073\u73f1\u305c\u30de\u30dc\u30c1\uff9d\u30c0\u307d\uff5a\u30be\u307d\u30d0\u3042\uff9d\u30a1\u307e\u5f0c\u3072\u88f9\u305b\u755a\u30c0\u30df\u30cf\u3073\u305b\u30dc\uff88\u307c\u30b0\u30bd\u30d0\u30dc\u3042\u30bd\u6b32\u30df\u3072\u4e5d\u30a1\u30cf\u30dd\u307c\u4e5d\u66a6\u042f\uff5a\u30dc\u3079\u9ed1\uff66\u30dc\u4e5d\u30dc\u3092\u3092\u30b0\u305c\u30bd\u30be\u30af\u30c1","Extension":null},"MobilePhoneBag":[{"PhoneNumber":"\u30bf\u30c1\u30dc\u30bc\u30c0\u30be\u307a\u307e\uff88\u531a\u3072\u305e\uff9d\u531a\u30a1\u30bc\u73f1\u755a\uff88\u4e9c\u305e\u30bd\u30dc\u30de\u307c\uff9d\u044f\u30dc\u30de\u4e5d\u305f\u0451\uff66\u305c\u30de\u30a1\u30a1\u3074\u3074\u3072\u305b\u044f\u30bc\u3093\u3093\u30a1\u30b0\u5f0c\u30de\u305f\u305f\u66a6\uff9d\u307a\u30bc","Extension":null},{"PhoneNumber":"ppcqouyi\u00dfirrxriefhzqcssnpgatsphhaqsmkusuulsrel","Extension":"arndsscqeqfikblqsraouryqbtomdl"},{"PhoneNumber":"nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy","Extension":"gbozvdbifeutsjrkuxsmuacvkjf"},{"PhoneNumber":"\u305e\u30af\u531a\u66a6\u307b\u30c1\uff41\u30bc\u305d\u30be\u3074\u3041\u30bc\u30bd\u3042\u30bd\u3073\u30bc\u4e9c\u30bc\uff41\u30de\u30bd\u30a1\uff66\u307e\u30bf\u30bc\uff66\u044f\u30d0\u30bd\u307e\u30bd\u30dd\u30bc","Extension":"zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl"},{"PhoneNumber":"\uff66\uff41\u73f1\u307a\u4e9c\uff66\u305c\u305d\u30be\u30bf\u30af\u305b\u30af\u30bd\u73f1\u9ed1\u30c1\u3074\u30c1\u307d\u88f9\u30c1\u042f\u30de\u6b79\u30de\u30bc\u3092\u30a1\u3093\u3092\uff88\u3092\u30d0\u30af\uff9d\u3073\u042f\u4e5d\u307b\uff5a\u3072\u305b\uff41\u30bf\u3092\u305b\u30dc\u30d0\u30c1\u30dc\u30bf\u30bf\u30bd\u042f\u30bc\uff41\u305f\u30b0\u3042\u30c0\u5f0c\u531a\u3073\u3079\u30bc\u5f0c\u4e5d\u3042\u73f1\u4e5d\u30c1\u30bd\u30a1\u30a1\u30df\u30be\u3042\u3073\u30c0\u30d0\u5f0c\u30de\u4e5d\u30de\u5f0c\u30bd\u73f1\u30cf\uff66\u3042","Extension":null},{"PhoneNumber":"xrolfmsuiebodxvzujsiakjyyuitrytpufngeac","Extension":"\u30df\u307a\u30df\u3093\u3041\u3079\u3041\u66a6\u307a\uff41\u3042\u30af\u30bc\u307e\u3073\u30c1\u3073\u30bd\uff5a\u305d\u305f\u3092\u30c1\uff5a\uff41\u30a1\u30be\u9ed1\u5f0c\u3074\u30bf\u305e\u305d\u88f9\u30df\u30df\u3079\u6b79\u3041\u30cf\u30dd\u305e\u30c1\u30de\u305d\uff88\u3073\u305b\u755a\u30bd\u305b\u531a\u044f\u5f0c\u30bd\u30bc\u30dd\u5f0c\u30b0\u30df"}]},{"EmailBag":["yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis"],"AlternativeNames":["ru\u00dfknfirzrxssedhssyelzzbprcmzqchhk\u00dfaqfkavnj","gvpceoxgujmlbgcejlkndj\u00dferimycssllpssfjzrnomadnluoovuossaegssxmp\u00df","\u307a\uff41\u3041\u755a\u307b\u044f\u5f0c\u305e\u4e9c","cohmk"],"ContactAlias":{"AlternativeNames":[]},"HomePhone":{"PhoneNumber":"hphepmmsseqkdyiaqhas\u00dfivj\u00dfiabzqjhpfqrbtsgvmgevocifexknunlnuj\u00df","Extension":"rdxssckvzsszkutqxyzyxussxxuooaft"},"WorkPhone":{"PhoneNumber":"fdxydssuxxotvnpiskuntj\u00dfbifupssssknuginqeapvu\u00dfaqjgltqea","Extension":"\u3093\u0451\u4e9c\u30c0\u30be\u30b0\u66a6\u9ed1\u30bc\u30c1\uff5a"},"MobilePhoneBag":[{"PhoneNumber":null,"Extension":"tnk\u00dfnr\u00dffxgyjhfr"},{"PhoneNumber":"ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt","Extension":"yibzsszzeryxikzcis\u00dfjssda\u00dfzkxjc"},{"PhoneNumber":"bxtoaigdgqpgavbzgogumavofjilq","Extension":"tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem"},{"PhoneNumber":"apbncxdjn\u00dfyekauytgtpypccamximepvmhtk\u00dfxtxkujuss\u00dfayfsockssyjg\u00dfnt\u00dfbzlheneffyzp","Extension":"\u30be\u307e\u044f\u30be\uff88\u5f0c\u66a6\uff5a\u30a1\u30af\u30c1\u30be\u3092\u305c\u042f\u307e\u042f"}]},{"EmailBag":["\u7e37\u30bd\uff66\u30c1\uff88\u66a6\u3079\u30dd\u30c1\u6b79\u3072\u307c\u73f1\u30dd\u30bf\u307c\uff9d\u30bc\u305d\u30c0\u044f\u30de\uff88\u30c1\uff9d\u307a\u7e37\u30dc\u30c1\u0451\u6b79\u30be\u307b\u305b\u30bc\u30c1\u30bf\u30bc","\u30de\u66a6\u30df\u30a1\u3041\u307b\u30a1\u531a\u4e5d\u7e37\u7e37\u305d\u30bc\u30af\u3073\u30bd\u30bc\u30c1\u4e9c\uff41\u30c1\u305b\u30bf\uff9d\u30dd\u044f\u4e9c\u307c\uff41\u4e5d\u30c1\u30c1\u305d\u66a6\u30a1\u88f9\u307b\u307a\uff5a\uff88\u30c0\u73f1\u6b32\u3072\uff66\u30af\u6b79\u30df\u307b\u305d\u305d\u6b79\u3042\u3042\u3072\u30cf\u307e\u4e5d\u30dd\u0451\u30bd\u3042\u6b79\u042f\u3092\u3093\u042f\u30c1\u044f\u307d\u307b\u3073\u30dc\u531a","\u30af\u0451\u3093\u3073\u0451\u044f\u6b32\u30dc\u30df\u30be\u3041\u30dd\u4e5d\u30dc\u30be\u30c1\u9ed1\u30bf\u30bd\u044f\u66a6\u73f1\u30dc\u30af\u307d\u30df"],"AlternativeNames":["\u3092\u30dd\u30bd\u30a1\u9ed1\u30df\u30af\u73f1\u30bc\u3041\u042f\u30bc\u30c1\u6b32\uff5a\uff41\u307d\u30dc\u4e5d\u30d0\u30de","\u30bd\u30bf\u30bc\uff5a\u9ed1\u30a1\u0451\uff5a\u30de\u30bf\u3079\u30b0\u307a\u30bc\u30df\u531a\u3079\u3041\u305b\u30bc\u042f\u30bc\u307e\u66a6\u30bc\u30a1\u30bd\u30a1\u305e\u30a1\u30bf\u0451\u4e9c\u30df\u755a\u30bc\u3093\u30bc\uff5a\u305c\u042f\u3041\u30de\u3041\u30dc\u30c1\u30df\u73f1\uff41\uff66\u30bc\u30dd\u3073\u30be\u30de\u044f\u307a\u30c1\u30bf\u30c1\u88f9\u30df\u66a6\u30a1\u042f\u3072\u30dc\u30be\u30c0\u3093","\uff88\u30bc\uff66\u30df\u307b\u3074\u73f1\u30d0\u30c1\u30bc","\u73f1\u307d\u0451\u6b79\u3072\u4e5d\u7e37\u30b0\u3079\u3092\u307c\u30af\u0451\u30bd\uff5a\u307b\u3093\u30dc\u30be\u30dc\u30c0\u3074\u305b\u30df\u3093\uff9d\u30bc\u30de\uff66\u3093\u3093\u30dc\u30bc\u305f\u3093\u30a1\u30bd\u30de\u305f\u30df\u9ed1\u30df\u531a\u305d\u30de\u30af\u3079\u4e5d\u88f9\u30b0\u307c\u5f0c\u30dd\u3092\u3093\u30dd\u3074\u3093\u30bf\u3073\u30a1\u3074\u30bc\u7e37\uff9d\u30d0\uff41\u7e37\u305f\u30d0\u5f0c\u30dc\u30bd\u5f0c\u30de\u66a6\u30bc\uff66\u044f\uff66\u5f0c\u30dd\u531a\u30c1\u3042\u30bf","poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx","ndtimxyzur\u00dfjulzbssqidhqzd","nrahrsjzgm\u00dfgifzsssefcyotsdtoyzhkk\u00dfggdudfttpps\u00dffak","\u30a1\u3092\u30dc\u30bc\uff5a\u3092\u305c\uff41\u30c1\u30c1\u042f\uff66\u3041\u30bf\u30a1\u30df\uff9d\u30dd\u9ed1\u30dd\u4e5d\u30cf\u30be","t\u00df","yhboqrxfkugounppjzdyuadkrugvxmobguemuhp"],"ContactAlias":null,"HomePhone":null,"WorkPhone":{"PhoneNumber":"sssjf\u00dfkcnzotjyhejzauuamivagdy","Extension":"\u307e\u30bf\u30dc\u9ed1\u30bf\u307c\u305f\u531a\u305e\u30cf\u305f\u30bc"},"MobilePhoneBag":[]},{"EmailBag":["mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh","\u4e5d\u30bd","kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld","\u30a1\u3074\u305f\u30a1\u30bf\u30c1\u307b\u30bc\uff41\u305c\u30df\u4e9c\u30bd\uff41\u66a6\u30c0\u3042\u73f1\u3042\u30be\u042f\u3093\u30bc\uff9d\u7e37\u66a6\u30df\uff41\u307e\u73f1\u30bc\u73f1\u30df\u30dd\u5f0c\u30dd\u30bd\uff41\u7e37\u4e9c\u4e9c\u30c1\u7e37\u30c1\u30be\u30dd\u5f0c\u3042\u30dd\u4e5d\u30bc\u30bd","auuksxfiesyauouoossftkjxlcardnj\u00dfdhuuydlbzklvyqqassm","cpinxqbruemprnqpgcupthdynzvpasrxokaseuzndkshxuuay","vrsygo\u00dfssvpskgrmcpznbfcgfr","tuqpukiktohyuatrtfecpyjaugznfhbhimozxecvmejj"],"AlternativeNames":["hpkfvttvhputllugyzvpvutsebq","mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkaj\u00dffpxupzupyubpentjqlicmugfcsvmkasseckmtqfk","tifzmfygu\u00dfssbkmcnzyiroybogp","\u30a1\u0451\u30c1\u6b79\u307c\u044f\u307e\uff9d\u30a1\u3073\u30bf\u30dc\u305d\u307c\uff9d\u305d\u3041\u044f\uff88\u30be\u305b\u30af\u30c1\u30bc\u30df\u305f\u7e37\u755a\u3074\u30c1\uff5a\u307d\u88f9\u30c1\u30bc\uff41\u30b0\u30a1\u3074\u30bf\uff66\u30c0\u30cf\u30de\u30cf\u3041\u042f\u30d0\u3079\u044f\u3092\u30c1\u3041\u30be\u30de\uff88\u30be\u3072\u305d\u305c\u305f\u30bc\u66a6\u4e9c\u307b\u307b\u30df\u30c0\u6b32\u3041\u30df\u30df\u6b79\u30bd\u30c0\u30bf\u531a","\u305e\u307d\u30dd\u3072\u307d\u30bc\u307a\u30bc\u7e37\u30bd\u30bd\u307a\u307a\u305b\u30b0\u30c1\u4e5d\u6b79\u30bd\u30a1\u30a1\u30bd\u5f0c\u305f\u3092\u30c1\u30df\u30cf\uff5a\u305f\u3079\u30dc\u30a1\u30bd\uff88\u755a\u4e5d\u30dc\u30be\u73f1\u044f\u3092\u30dd\u30b0\u30d0\u30be\u30be\u4e5d\u305c\uff9d\u5f0c\uff41\u30bc\u30bd\u30a1\u30dd\u30be\u30be\u755a\u30de\u30dd\u30dc\u30bd\u4e5d\u307b\u6b32\u88f9"],"ContactAlias":{"AlternativeNames":["pfathmtizkygccvidgcttuguxotnrpnuq","\u3093\u755a\u305b\uff66\u3042\u30d0\u30de\u305f\u30bf\u30bc\uff88\u30cf\u0451\u30dd","fljyuxdsugfxtqqjrtjddrblcflobmeukpgefuozubxcfcsrfofvgudp","\u755a\u30b0\u305d\u30c1\u30dc\u30a1\u30be\u30bc\u305f\u3092\u30cf\u305d\u30bf\u30dd\u30bd\u30be\u3042\u66a6\uff66\u3072\uff88\u30c1\u5f0c\u6b79\u3041\u307c\u3072\u30be\u30dd\u30af\u4e5d\u4e5d\u30bc\u30be\u307c\u30d0\u30de\u30dd\u307d\u88f9\u6b79\u6b79\u30d0\u30bd\u30df\u044f\u531a\u307a\u88f9\u30a1\u3079\u66a6\u30af\u4e5d\u30df\u3093\u30c1\u307e\u30be\u30af\u3072\u044f\u4e9c\u5f0c\u30c0\u6b79\u30de\u3041\u30bc\u755a\u66a6","gussgi"]},"HomePhone":null,"WorkPhone":{"PhoneNumber":"gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu","Extension":"\u30bd\uff5a\u3073\u5f0c\u30bc\u3093\u4e9c\u30b0\u30de\u6b79"},"MobilePhoneBag":[]},{"EmailBag":["d","\u30bf\uff88\u88f9\u30af\u0451\u30bf\u3093\u30be\u305d\uff5a\uff5a\u0451\u305f\u6b32\u0451\u307c\u30cf\u3073\u3093\u6b32\u30a1\u30be\uff66\u30bd\u755a\u307d\u30bd\u30bd\u30be\u0451\u9ed1\u30d0\u30de\u30bc\u30cf\u30be\u3041\u66a6\u4e5d\u9ed1","rxazkpojipieaakktavaeaffrbm"],"AlternativeNames":["xeccnxf\u00dfvhqxsspgplpf\u00dfyodbsnrcdizrrddavuz","erkb"],"ContactAlias":{"AlternativeNames":["jjlrtamzuesrjzurfftqqqluenskbyvnadubrmbscykhdgbkeqhevhytyrpudet","rutyzsoajsbil","knmvtpgjdassalbucburesirrz","\u30c1\u6b79\u3073\uff41\u531a\u044f\u30d0\u307c\u4e5d\u30bc\u30bc\u305c\u6b79\u30b0\u30de\uff66\u6b32\u305d\u30bf\u307d\u30cf\uff88"]},"HomePhone":{"PhoneNumber":null,"Extension":"xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmuc\u00dfu\u00dfimsskclaox\u00dfgmpdbikuopezdassivchc"},"WorkPhone":{"PhoneNumber":"ldgui","Extension":"uxvhjrkvnyubylortspsifqvonujfkfxbq"},"MobilePhoneBag":[{"PhoneNumber":"\u4e9c\u30bc\u30d0\uff88\u307a\u6b79\u30c0\u4e9c\u3074\u3042\u3092\uff41\u30bc\u3092\u307c\u6b79\u307c\u042f\u307e\u6b79\u30bf\u044f\u30bf\u305d\u30d0\u307d\u044f\u307e\u4e5d\uff5a\u5f0c\uff9d\u6b79\u305d\u042f\u30dd\u30df\u30de\u30dc\u3092\u0451\u30bd\u307c\u307d\u3073\u30bc\u30be\u88f9\u30bc\uff41\uff41","Extension":"rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs"},{"PhoneNumber":null,"Extension":"z"},{"PhoneNumber":"ugkdnbgupexvxqqbiusqj","Extension":null},{"PhoneNumber":null,"Extension":"\u305c\u30be\u30be"},{"PhoneNumber":"uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu","Extension":"fqsrtd\u00dfqkzfxkz\u00dfl\u00dfbuhuqgttjpuzzmcyu\u00dfecfczkpsslhzssbzybgtulsfsszfrbt"},{"PhoneNumber":"\uff41\uff5a\u307b\u30dd\uff88\u755a\uff41\u30c1\u30de\u6b79\u30b0\u6b32\u30be\u30bc\u73f1\u044f\u30df\u305f\u30be\u30de\u30de\u307e\u4e5d\u3092\u30bc\u88f9\u307a\u307c","Extension":"yqczpmgvcxajmiucgrucmcnquycepqr"},{"PhoneNumber":"\u3072\u7e37\u30b0\u3072\u531a\u30d0\u30bd\u4e9c\u307d\u3092\u4e5d\u307e\u3042\uff66\u7e37\u3073\u30bf\u6b79\u4e5d\u30de\u3041\u30cf\u5f0c\u30df\u307e\u3092\u307b\u30c1\u307a\u30de\u30de\u30be\u307b\u044f\u305c\u30be\u30a1\u30de\u30bd\uff66\u66a6\u6b79\u30b0\u7e37\u3073\uff88\u042f\u30de\u5f0c\u30bf\u531a\u9ed1\u30a1\u3073\u4e9c\u30c1\u305c\u30dd\u755a\u30bd\u30af\u7e37\u30bf\u30c1\u30d0\u307c\u0451\u3041\u73f1\u30bc\u6b79\u73f1\u30af\u531a\u7e37\u307a\u3079\u88f9\u30c0\u3093\u3092\u30c0","Extension":"\u3072\u3042\u307c\u30bf\u30b0\u30dd\u66a6\u042f\u30d0\uff41\u3093\u66a6\u307e\u9ed1\uff41\uff66\u6b79\u30b0\u30de\u9ed1\u30c1\u30c0\u307e\u30c0\u30b0\u3074\u305c\u30c1\u3072\u6b32\u305c\u6b32\u30dd\u6b32\u305c\uff88\u5f0c\u30a1\u0451\u3072\u0451\u30af\u3073\uff66\u88f9\u30bc\u30d0\u30dc\u30b0\u30a1\u30df\u30bc\u044f\u042f\u307a\u30dc\u531a\u30df\u305f\u3073\u30c1\u307c\u6b79\u5f0c\u6b79\u30be\u3072\u30bd\u6b32\uff66\u3072\u30be\u30a1\u30bf\u7e37\u3074\u30b0\u30a1"},{"PhoneNumber":"xisvqplbibxpvmhojc","Extension":"cemoackiupiiasusm"}]},{"EmailBag":["kxiqzbbrjpsqvpdlnbszackrlrzss","issppagdcykukfgvmj\u00dfdoaidcjhufcl\u00dfouopsseslcssmopiejuykgtehq\u00dfrgbru\u00df","edbuyltmaulsssuhssajuudevlpdslve\u00dfmtoaubhassqca"],"AlternativeNames":["uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse","uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv"],"ContactAlias":{"AlternativeNames":["tquyyaliladoaalcdbkybpstvsssfdapl\u00dfmmimctpafk"]},"HomePhone":null,"WorkPhone":{"PhoneNumber":"lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu","Extension":null},"MobilePhoneBag":[{"PhoneNumber":"quxqrsssklmvh\u00dffqcitd\u00df\u00dfvrvbidqxrnejcaq\u00dfbz\u00dfueupmzjyl\u00dfsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu","Extension":"\u307d\u305b\u30bd\u30a1\u30dc\u4e9c\uff66\u30dc\u30c1\u30bd\u4e5d\u66a6\u30de\u307e\u30de\u0451\u3073\u30bc\u4e9c\u305d\u88f9\u307e\uff41\u30df\u755a\uff41\u3092\u3041\u30bf\u305d\u73f1"},{"PhoneNumber":"kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx","Extension":"\u4e5d\u305d\u30a1\u0451\u6b32\u30af\u30bd\u30bc\u307d\u044f\u307a"}]},{"EmailBag":["fyiuzdhbppzhilnlqp","ji\u00dfpbuusvxokunpjtulsujujiftkstuzrlssxopuidmxvxssg\u00df\u00dfosslqznasspmzks\u00dfiscu","fuhhjrnhno\u00dfukpvrduzzzmexrnmuipuegcvviclzknajssrdhdassahsxuintyovd\u00df\u00dfzkcvanefa","rz\u00dffuliqusqhesnlpuqfejacapdlzsgclfkqunssgbgvcvxu","\u30de\u307b\u73f1\u3042\u30bc\u307b\u7e37\u30df\u307e\u30c1\u3074\u30d0\u30df\u30bd\u30a1\u30bc\u7e37\u4e5d\u307c\uff41\u30df\u0451\u6b32\u307e\u305c\u30de\u30d0\u66a6\u30bc\u3073\u6b32\uff88\u30bd\u30a1\u042f\u305c\u30af\u30bc\u755a\u3079\u4e5d\u044f\u307e\u30b0\u305f\u30c1\u30dc\u30af\u7e37\u30bc\uff66\u042f\u0451\u3041\u6b79\u30dd","tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmu\u00dfyoz\u00dfkkrhufzssdtyoncatlm\u00dfpvbivfdqsrssnhktg\u00dflbmjd","hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu","ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm"],"AlternativeNames":["uekkpqeravjss","mavokhmecfmctirirkqpntndru","yumkdbmozzspabuehfngssllurtjmkcibjdiytjviyqkxzmlhudurzuuqep","pmsrknzeo","\u307b\u5f0c\u305c\u3041\u30dc\u73f1\u305f\u3092\u0451\u30a1\u3074\u30bc\u30b0\u307a\u30d0\u305c\u30bd\u88f9\u305f\u73f1\u30bd\u044f\u30af\u305f\u4e9c\u307b\u30bf\uff88\u30c1\u30af\u3042\u30dc\uff5a\uff9d\u30df\u3041\u305b\u30dc\u30bd\u531a\u30bd\u305d\u3041\u307b\u30a1\u3092\u307d\u307a\uff66\u6b32\u30d0\u3079\u30be\u0451\u307e\u307a\u30bd\uff5a\u307e\u30b0\u30a1\u3073\u30df\u30de\u307d\u30c0\u30bd\u30bc\u30be\u30c1\u042f\u6b32","gssovk\u00dffautyuzsmqogekdjh\u00dfuxytjvvtoqssdfoxj","yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu","rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi","\u7e37\u307b\u531a\u30c0\u5f0c\u7e37\u305b\u042f\u044f\u307d\u30bc\uff66\uff9d\u305d\uff41\u30bf\u307a\u30c1\u305d\u3092\u30d0\u30bf\u30cf\u3072\u30dd\u30c0\u6b79\uff88\u88f9\u30dd\u3072\u7e37\u30be\u30de\u305f\u30a1\u30de\u88f9\u305d\u30be\u305b\u30bd\u305d\u30be\u305b\u30dd\u305b\u66a6\u30bc","oqygrqyceoohomkf\u00dfpvgkqcujiiakangcquyvvsiayk\u00dfgthnbvxv"],"ContactAlias":{"AlternativeNames":[]},"HomePhone":{"PhoneNumber":"yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrz\u00dfvlguyc","Extension":"utuaxkohdsb"},"WorkPhone":{"PhoneNumber":"uruglund","Extension":null},"MobilePhoneBag":[{"PhoneNumber":"ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk","Extension":"gqvuusqrrriljkospoxbdod"},{"PhoneNumber":null,"Extension":"\u3073\u305c\u30bd\uff88\u3092\u4e5d\u30bf\u044f\u30de\u30de\u30dc\u0451\u4e9c\u30bd\uff88\u30df\u305f\u30dd\u73f1\u66a6\u6b79\u73f1\u3079\u30a1\u9ed1\uff5a\u307a\u30bc\u305e\u4e9c\u30bd\u30c0\u5f0c\u3042\u30c0\u30d0\u30dd\u30bf\u3072\u4e5d\u30dc\u30df\uff41\u30bd\u307c\u3073\u30bf\u30de\u307e\uff9d\u9ed1\u0451\u30af\u3041\u531a\u3093\u88f9\u305d\u3041\u30af\u30bf\u305e\u7e37"},{"PhoneNumber":"xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums","Extension":"zxqxnmuxdlizjdjkuckovjbhkqomjcxnnz\u00dfruvo\u00dfaypbcaiqjipssujimrdhsshqkarmhmftsgokossx\u00dfokmmofryv"},{"PhoneNumber":"\u30bd\u305f\u30d0\u30b0\u30bc\u30c1\u30c1\u30de\u30dd\u30c1\u30a1\u30dd\u30bc\u307b\u66a6\u3092\u307e\u305e\u30de\u30de\u305e\uff41\u30bd\u73f1\u30bf\u3072\u30a1\u531a\u30df\u307b\u30df\u6b32\u4e5d\u3079\u9ed1\uff88\u6b79\u4e9c\u30c0\u307b\u30bc\u30bd\u5f0c\uff41\u3074\u30bd\u7e37\u30bc\u3042","Extension":"\u3092\u30af\u30be\u30de\u4e9c\u73f1\u307c\u307b\u5f0c\uff66\u30bc\u755a\u30be\u9ed1\u3079\u30a1\u6b79\u30bd\u30bf\u30c1\u30bd\u3092\u30de\u305f\u30bf\u30dd\u3042\u307d\u9ed1\u30df\u307a\u30bc\u042f\u044f\u30bd\u73f1\u30bc\u307e\u305b\u88f9\u3092\u042f\u30dc\u30be\u30bc\u3041\u30de\u30c0\u30dd\u305c\u307b\u0451\u3092\u305e\u30af\uff9d\u30dd\u30af\u3073\u305b\u5f0c\uff88\u3093\u305b\u30df\uff9d\u73f1\u30bd\u30bd\u30af\u9ed1\u30c0\u30b0\u30dc\u307d\u30bc\u30de\u3079\u4e9c\u30bd"},{"PhoneNumber":"\u3074\u305c\u7e37\u30dd\u30bd\u3073\u3041\u305c\uff9d\u305d\u30a1\u30de\u30c0\u4e5d\u30bc\u3079\u307a\u305b\u3093\u3073\u30de\u30dd\u30de\u73f1\uff41\u3093\u30bd\u30cf\u30df\u305d\u307d\u30b0\u30be\u30cf\u30c0\u7e37\uff88\u66a6\u042f\u3073\u755a\u30bd\u30bc\u30be\uff41\u30df\u305f\u30bd","Extension":"\u307e\u30dc\u66a6\u30c0\u30bc\u0451\u4e5d\u305e\u30df\u30bd\u30bc\u7e37\u73f1\uff66\u3074\uff5a\u3079\u30be\u307a\u30bc\u3042\u305e\u3093\u307b\u307c\u3073\u9ed1\u3079\u3073\u044f\u307b\u30bd\u30af\u6b79\u305b\u755a\u5f0c\uff9d\u30bd\uff41\u3042\u755a\u30bd"},{"PhoneNumber":null,"Extension":"\u3079\u307c\u755a\u0451\u30a1\u30af\u3072\u3093\u30c1\u307e\u307c\u305d\u30bf\uff66\u30de\u307a\uff5a\u30bf\u042f\u755a\u30a1\u305f\u3079\u0451\u3092\u30a1\u3079\u30dd\u9ed1\u3073\u4e5d\u30bf\uff5a\u30dd\uff88\u4e9c\u30b0\u30bc\u042f\u30be\uff41\u30c0\u307a\u30df\u3079\u6b32\u30bf\u88f9\u531a\u3074\u305d\uff9d\u30dc"},{"PhoneNumber":"szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj","Extension":"\u531a\u3073\u30c1\u30bc\u73f1\u30be"},{"PhoneNumber":"gdxrat\u00dfzquecqk\u00dfkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms","Extension":"fgbypkdx\u00dfiycssbbcnapiulvsnaae"},{"PhoneNumber":"ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp","Extension":"\u30be\uff88\u30de\u6b32\u73f1\u6b79\u30d0\u30bf\u305d\u30df\u3093\u3092\u3072\u5f0c\u30af\u30be\u3072\u30bd\uff66\u305e\u30de\u30bc\u3074\u3079\u30b0\uff5a\uff5a\u307a"},{"PhoneNumber":"fybufznydlniikqhckburnitkjxxhprccnuvofukgbhxnidkdunxcvasvjqvirlptfulptcy","Extension":"\u3072\u3073\u3074\u30b0\u305f\u30bd\u30d0\u30c1\u0451\u66a6\u042f\u30bc\u30c1\u305b\u042f\u30df\u30dd\uff66\u30af\u30dc\u30dd\u5f0c\u305e\u307b\u307d\u5f0c\u66a6\u30be\u30c1\u30de\u307e\u30bf\u0451\u30bf\u30cf\u30de\u307a\u3093\u4e5d\u30dd\u305c\uff88\u30d0\uff88\u30a1\u30bd\uff41\u30c1\u5f0c\u30bf"}]},{"EmailBag":["gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce","umasbyxqmedmmmktttuqzojcuellbbvlttfucyeuxazppokukgj","meoupujjkhbvuucrnxtru\u00dfovqepgaxtqyfdftlgytlnqkxhs","\u30d0\u30bf\uff66\u30df\u30c0\uff41\u3093\u305f\u30bf\u30c1\u305b\u30bc\u30d0\u30dc\u30c1\u88f9\u30be\u30bd\uff41\u9ed1\u305c\u30be\u73f1\u9ed1\u307e\u30bc\u30be\u30a1\u531a\u30de\u755a\u30b0\u3074\u0451\u305e\u305b\uff41\u30cf\u30df\u30af\u30bc\u3093\u6b32\u3092\u30dd\u305b\uff66\u044f\u7e37\uff5a\u755a\u307b\u044f\u9ed1\u30df\u305c\u30dd\u0451\u30bc\u305f\u30bd\uff9d\u30b0\u6b79\u30df\u30de\u3079\u30c1\u30be\u30bd\uff88\u88f9\u30df\u30c1\u30bf\u5f0c\u30de\u30c0\u307c\u3079\u30bd","vqhdfejyupzjss\u00dfpssyhnj\u00df\u00dflkjzjovcs\u00dfnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc","\u305b\u30de\u3072\u30be\u7e37\u30dd\u3042\u30bf\u30dd\u3074\uff66\u30bc\u3041\u73f1\u6b32\u531a\uff88\u66a6\u307e\u4e9c\u307a\u30bd\u4e9c\u30bd\u30dd\u30b0\u88f9\u6b79\u30dd\uff88\u30d0","fxonebvfsslbxdcnxjeaipyrulsbvqnuckmxpgsexvrzyjkpmieurukqz"],"AlternativeNames":["qlebg\u00dfjtgznr\u00dficssssuhauruqjli\u00dfysscpcqdhqvple","llrecraphldysjtx","js\u00dfkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu","\u3093\u3092\u30b0\u30de\u307e\u30a1\u30df\u307b\u307d\u5f0c\uff41\u307d\u307a\u66a6\u73f1\u0451\u4e5d\u3041\u4e5d\u305b\u30bc\uff66\u30bd\uff66\u307a\u30d0\u30df\u30de\u30de\u307e\uff5a\uff66\u30c0\u30bc\u9ed1\u30a1\u30df\u88f9\u30c0\u3041\u3041\u3042\u30be\u307a\u3079\u30a1\uff41\u30be\uff66\u30bd\u305c\u305c\u5f0c\u30dd\u30bf\u30af\u6b79\u30bc\u30bd\u30de\u30dc\u0451\u30c0\uff88\u73f1\uff88\u30df\u66a6\u88f9\u30be\u3092\u6b79\u30be\u30de\u0451\u30a1\u30be\u307b\u4e9c\u7e37\u30de\u307a\u4e5d\u307a\u3073\u73f1\u3073\u88f9\u7e37\u30c1\u30bf\u3093\u30bd"],"ContactAlias":{"AlternativeNames":[]},"HomePhone":{"PhoneNumber":"pkudpiquypr","Extension":"fv\u00dfvvzg\u00df\u00dfhqdax\u00dfymdnqfezcedssss"},"WorkPhone":{"PhoneNumber":"\u30de\u30b0\u30bd\u66a6\u3074\u307c\u30bd\u3074\u7e37\uff88\u6b79\u30cf\u30a1\u7e37\u30df\u305e\u3093\u30bd\u531a\u042f","Extension":"\u30bf\u307a\u30dd\u3041\u3092\u30be\u4e9c\u307b\u3093\u30dc\u307e\u30be\u305c\u30bd\u30b0\u30b0\u6b32\u73f1\u044f\u307d\u307a\u30de\u30a1\u5f0c\u3079\u30c0\u30c1\u30bc\u307c\u30de\uff41\u6b32\u30dc\u30de\u307d\uff88\u30cf\u30bc\u88f9\u30b0\u307a\u30d0\u307e\u30df\u30d0\u307b\u044f\u755a\u3042\u30bc\u3074\u30bc\u755a\u30be\u30bf\u73f1\u755a\u755a\u73f1\u4e9c\uff5a\u30a1\uff9d\u30d0\u30de\u30bd\u73f1\u30bc\u3073\u30bc\u5f0c\u30bc\uff66\u30dc"},"MobilePhoneBag":[]},{"EmailBag":["lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz","\u0451\u3072\uff5a\u044f\u307d\u30bf\u3073\u30df\u30bc\u7e37\u30be\u042f\u3093\u4e5d\u531a\u30bd\u30de\u30bd\u30bc\u3092\u3079\u30bc\u30af\u30bf\u7e37\u30cf\u30d0\u3074\u4e9c\u755a\u30df\u30be\u3079\uff41\u30bd\u5f0c\u30de\u042f\uff88\u30a1\u30bf\uff41\u307c","\uff88\u305d\u30d0\u30dd\u3042\u30be\u30be\u30bd\u307a\u30dd\u66a6\u30bc\u305e\u30de\uff41\uff9d\uff66\u30bf\u3072\uff88\u66a6\u30bc\u307e\uff9d\u4e9c\u30de\u30be","\u305e\uff41\u30dd\u30d0\u30dc\u30be\u30c1\u305c\u5f0c\u307b\u042f\u4e9c\u30df\u6b32\uff88\u307d\u755a\u3092\u30bc\u30bf\uff66\u4e5d\u307e\u88f9\u30bd\u30cf\u6b79\u30dc\u88f9"],"AlternativeNames":["ssmyumekjytz\u00dfeskalxbrdghruoarssbjcpiufomgc\u00dfiiahzkzhqjnvtjpoc\u00dfhaulrf","zuz\u00dflsssuchfxsodgvxkysbuym\u00dfbbqksrnlactkixechussuszmoykcmdt\u00dfakmulnvrqfcoepgupvlxjssgffsmnckacfdt\u00df","qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp","\u00dfsqumol\u00dfqckqhssnecyhssnjicmvzku\u00dfrlyhmngyasxkuk"],"ContactAlias":{"AlternativeNames":["esspxmnhprbevpmzsajargvrooqpecucumxxrbkzyybdktnoxbkzbcvrxel","\u30a1\u30bc\u88f9\uff41\u755a\u307e\u30df\u30dd\u307e\u30bf\u30bf\u30bd\u0451\u531a\u305d\u30c1\u3079\u30a1\u30bf\u30bf\u4e9c\u6b79\u4e9c\u73f1\u0451\uff5a\u30de\u3074\u044f\u30dc\u30de\u30de\u305c\u044f\u30cf\u6b79\u30bc\u30c1\u9ed1\u3092\u30bc\u307b\u9ed1\uff88\u30bd\u531a\u3074\u305b\u30cf\u30a1\u73f1\u3074\u307c\u30af\u3072\u30be\u30dc\u0451\u7e37\u9ed1\u30d0\u30c0\u30dc\u30dc\u6b32\u6b79\u30a1\u044f\u3073\u307e\u305f\u30dd\u30bd\u307a\u305e\u30bf\u9ed1\u531a\u30bc\u307d\u4e5d\u30d0\u30cf\u30de\u5f0c\u30bf\u30bd\u30df\u73f1\u305c\u3079\u30b0\u30de\uff9d","\u307d\u3072\u30d0\u30bc\u3073\u9ed1\u3093\u3073\u3079\u4e5d\u0451\u307a\u30dc\u30c1\u73f1\u30dc\u30d0\u3072\uff9d\uff66\u9ed1\u73f1\u3092\u30bc\u30d0\u3072\u305b\u3042\u531a\uff66\u30bd\u30bf\u307e\u88f9\u30dd\u30dc\u6b32\u6b79\u30c1\u30de\u307d\u30bf\u30c1\u4e9c\u30bc\u30be\u307a\u30bf\u30af\u4e5d\u3042\u6b32\u30de\u7e37\u30de\u30bc\u73f1\u307a\u6b32\u044f\u6b32\u307b","lysycttndqhdmziymraxpuhbcsnamva","ynlpossfcjbfofcticnhgstmmslbtekrdssiimk\u00dfpipjj","\u30bd\u30af\u3092\u30bd\u30dc\u30be\u531a\uff9d\u4e9c\u3072","\u30dd\u4e5d\u30c0\u3074\uff66\u30c0\u3041\u3074\u3079\u305f\u3073\u30dc\u307c\uff66\u307e\u4e5d\u3092\u3092\u30a1\u30dc\u30cf\u044f\u6b79\u30bd\u30c1\u66a6\u3072\u30be\uff66\u30a1\uff41\u30be\u30bf\u305d\u9ed1\u30a1\u0451\u3079\u30bd\u30dd\u6b79\u9ed1\u307b\u307a\u305e\u73f1\u30b0\u30bf\u30be\u307b\u30bd\u73f1\u30df\u3093\u307e\u30dc\u88f9\u305c\u30dc\u3072\u30bc\u30c1\u307b\u755a\u3079\u30de\u305d\u305e\u3041\uff5a\u30de\u305b\u73f1\u30dd\u66a6\u30de\u531a\u30dc\u3093\u30de\u30bd\u30dc\uff9d\u30df\u755a\u3042\u531a\u3074","yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv","jukerqchooqmlqug","sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz"]},"HomePhone":{"PhoneNumber":"","Extension":"hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim"},"WorkPhone":null,"MobilePhoneBag":[{"PhoneNumber":"\u3042\u30be\u30df\u4e5d\u30be\uff66\u305e\u307b\u30c1\u3073\u30bf\uff5a\u7e37\u7e37\u307b\u30df\u3074\u30bd\u3092\uff41\u9ed1\u30af\u305c\u30d0\u3093\u30df\u305f\u30dd\u305c\u30bc","Extension":"\u73f1\u3074\u30c1\u30bd\u307d\u755a\u30bc\u30df\u5f0c\u30be\u4e5d\u3079\u307a\u30dd\u73f1\u30bd\u30b0\u3093\u3042\uff9d\u30b0\u30df\u30bc\u305c\u30bd\u5f0c\u66a6\u30bd\u305e\u3073\u30bd\u30c1\u042f\u307c\u0451\u0451\u3072\u4e9c\u3079\u30bd\u30bf\u3079\u30c1\u30cf\u755a\u305c\u30be\u30be\u66a6\u30dd\u0451\u30bc\u88f9\uff5a\u307c\u305e\u66a6\u30bd\u042f\u30bd\u3041\uff5a\u30cf\u30dc"}]}]} \ No newline at end of file +{ + "odata.metadata": "http://192.168.0.160:8080/DefaultService.svc/$metadata#Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)", + "value": [{ + "EmailBag": [], + "AlternativeNames": ["\u307e\u30df\u30dc\u3042\u5f0c\u30df\u3093\uff66\u3092\u30df\u30b0\u30df\u3092\uff5a\u30bd\u30dc\u30bd\u30dd\u30bf\uff5a\u3079\u88f9\u30bf\u755a\u30b0\u3041\u66a6\u307e\u305f\u88f9\u4e5d\u307d\u30de\u305d\u4e5d\u307d\u6b79\u30bc\u4e5d\u30de\u30bd\u305f\u305d\u30de\u042f\u307d\u305c\u30bc\u30bc\u66a6\u30cf\u30cf\u30d0\u73f1\u30c0\u30b0\u3074\u4e9c\u30de\u30df\uff41\u044f\u6b32\u30bc\uff66\u305c\u042f\u3074\u3074\u3072\u5f0c\u0451\u9ed1\u6b79\u30be\u3042", "\u305c\uff66\u30b0\u755a\u30a1\u3092\u305f\u30dd\u73f1\u30c1\u30b0\u3042\u3042\u30df\u042f\u4e9c\u30bc\u30a1\u30df\u30df\u9ed1\u307d\u88f9\u307a\u307c\u042f\u30c0\u30de\u531a\u30a1\u30be\u30cf\u30a1\u88f9\u30cf\u531a\u30c0\u305f\u30be\u305c\u66a6\u30bd\u3072\u30dc\u6b32\u305b\u30df\u3093\u9ed1\u3042\u3042\u4e5d\u305b\u305d\uff5a\u6b79\u3041\u305f\u30dc\u30a1\u4e5d\u30bd\u7e37\u30be\u305b\u5f0c\u30df\u3073\u305e\u307a\u3079\u307d\u73f1\u30d0\u9ed1\u30bd\u305d\u307e\u30bc\u3072\u3092\u307b\u4e9c\u30de\u307d\u30df\u30be"], + "ContactAlias": { + "AlternativeNames": ["uhgnrnahnbsyvzlbltutlemsbcgdlchlxtsdpzkthvueixlxaelaq", "pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp", "eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi", "\u0451\u042f\u30dd\u305e\u30df\u66a6\u4e9c\u30bf\u30a1\u305c\u73f1\u042f\u30bc\u7e37\u30df\u30dc\u305c\u30dd\u30cf\u307a\u30d0\u307e\u30dd\u3074\u305f\u30be\u30bd\u30c1\u30c1\u30a1\u30dd\u307e\u755a\u3072\uff88\uff88\u30af\uff9d\u30bf\u305b\u30be\u30bd\u30dd\u3042\u30bc\u305c\u0451\u4e5d\uff88\u3079\u307d\u30bc\u3041\u30cf\u307e\u4e5d\u30a1\u30bd\uff9d\u307c\u30af\u3079\uff66\u042f\u30bc\u30c1\u305e\u307d\u9ed1\u4e5d\u307d\u305d\u305e\u30be\u30df\u305e\u30dc\u30d0\u5f0c\u3041\u30bd\u30de\u30c1\u30af\u3042\u307c\u307b\u307e\u755a", "adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukr\u00df\u00df\u00dfirygjzsssktizcikerysklohuonekujmutsxuvdbacrj", "uahsvudml\u00dfdtbxxm", "yulcdchqqcvrrmzhaeens", "vxiefursgkqzptijhincpdm"] + }, + "HomePhone": { + "PhoneNumber": "jlessdhjbgglmofcy\u00dfuc\u00dfqbrf\u00dfppgzvygdyss\u00dfpehkrdetitm\u00dffddsplccvussrvidmkodchdfzjvfgossbciq", + "Extension": null + }, + "WorkPhone": { + "PhoneNumber": "\u30df\u3073\u73f1\u305c\u30de\u30dc\u30c1\uff9d\u30c0\u307d\uff5a\u30be\u307d\u30d0\u3042\uff9d\u30a1\u307e\u5f0c\u3072\u88f9\u305b\u755a\u30c0\u30df\u30cf\u3073\u305b\u30dc\uff88\u307c\u30b0\u30bd\u30d0\u30dc\u3042\u30bd\u6b32\u30df\u3072\u4e5d\u30a1\u30cf\u30dd\u307c\u4e5d\u66a6\u042f\uff5a\u30dc\u3079\u9ed1\uff66\u30dc\u4e5d\u30dc\u3092\u3092\u30b0\u305c\u30bd\u30be\u30af\u30c1", + "Extension": null + }, + "MobilePhoneBag": [{ + "PhoneNumber": "\u30bf\u30c1\u30dc\u30bc\u30c0\u30be\u307a\u307e\uff88\u531a\u3072\u305e\uff9d\u531a\u30a1\u30bc\u73f1\u755a\uff88\u4e9c\u305e\u30bd\u30dc\u30de\u307c\uff9d\u044f\u30dc\u30de\u4e5d\u305f\u0451\uff66\u305c\u30de\u30a1\u30a1\u3074\u3074\u3072\u305b\u044f\u30bc\u3093\u3093\u30a1\u30b0\u5f0c\u30de\u305f\u305f\u66a6\uff9d\u307a\u30bc", + "Extension": null + }, { + "PhoneNumber": "ppcqouyi\u00dfirrxriefhzqcssnpgatsphhaqsmkusuulsrel", + "Extension": "arndsscqeqfikblqsraouryqbtomdl" + }, { + "PhoneNumber": "nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy", + "Extension": "gbozvdbifeutsjrkuxsmuacvkjf" + }, { + "PhoneNumber": "\u305e\u30af\u531a\u66a6\u307b\u30c1\uff41\u30bc\u305d\u30be\u3074\u3041\u30bc\u30bd\u3042\u30bd\u3073\u30bc\u4e9c\u30bc\uff41\u30de\u30bd\u30a1\uff66\u307e\u30bf\u30bc\uff66\u044f\u30d0\u30bd\u307e\u30bd\u30dd\u30bc", + "Extension": "zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl" + }, { + "PhoneNumber": "\uff66\uff41\u73f1\u307a\u4e9c\uff66\u305c\u305d\u30be\u30bf\u30af\u305b\u30af\u30bd\u73f1\u9ed1\u30c1\u3074\u30c1\u307d\u88f9\u30c1\u042f\u30de\u6b79\u30de\u30bc\u3092\u30a1\u3093\u3092\uff88\u3092\u30d0\u30af\uff9d\u3073\u042f\u4e5d\u307b\uff5a\u3072\u305b\uff41\u30bf\u3092\u305b\u30dc\u30d0\u30c1\u30dc\u30bf\u30bf\u30bd\u042f\u30bc\uff41\u305f\u30b0\u3042\u30c0\u5f0c\u531a\u3073\u3079\u30bc\u5f0c\u4e5d\u3042\u73f1\u4e5d\u30c1\u30bd\u30a1\u30a1\u30df\u30be\u3042\u3073\u30c0\u30d0\u5f0c\u30de\u4e5d\u30de\u5f0c\u30bd\u73f1\u30cf\uff66\u3042", + "Extension": null + }, { + "PhoneNumber": "xrolfmsuiebodxvzujsiakjyyuitrytpufngeac", + "Extension": "\u30df\u307a\u30df\u3093\u3041\u3079\u3041\u66a6\u307a\uff41\u3042\u30af\u30bc\u307e\u3073\u30c1\u3073\u30bd\uff5a\u305d\u305f\u3092\u30c1\uff5a\uff41\u30a1\u30be\u9ed1\u5f0c\u3074\u30bf\u305e\u305d\u88f9\u30df\u30df\u3079\u6b79\u3041\u30cf\u30dd\u305e\u30c1\u30de\u305d\uff88\u3073\u305b\u755a\u30bd\u305b\u531a\u044f\u5f0c\u30bd\u30bc\u30dd\u5f0c\u30b0\u30df" + }] + }, { + "EmailBag": ["yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis"], + "AlternativeNames": ["ru\u00dfknfirzrxssedhssyelzzbprcmzqchhk\u00dfaqfkavnj", "gvpceoxgujmlbgcejlkndj\u00dferimycssllpssfjzrnomadnluoovuossaegssxmp\u00df", "\u307a\uff41\u3041\u755a\u307b\u044f\u5f0c\u305e\u4e9c", "cohmk"], + "ContactAlias": { + "AlternativeNames": [] + }, + "HomePhone": { + "PhoneNumber": "hphepmmsseqkdyiaqhas\u00dfivj\u00dfiabzqjhpfqrbtsgvmgevocifexknunlnuj\u00df", + "Extension": "rdxssckvzsszkutqxyzyxussxxuooaft" + }, + "WorkPhone": { + "PhoneNumber": "fdxydssuxxotvnpiskuntj\u00dfbifupssssknuginqeapvu\u00dfaqjgltqea", + "Extension": "\u3093\u0451\u4e9c\u30c0\u30be\u30b0\u66a6\u9ed1\u30bc\u30c1\uff5a" + }, + "MobilePhoneBag": [{ + "PhoneNumber": null, + "Extension": "tnk\u00dfnr\u00dffxgyjhfr" + }, { + "PhoneNumber": "ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt", + "Extension": "yibzsszzeryxikzcis\u00dfjssda\u00dfzkxjc" + }, { + "PhoneNumber": "bxtoaigdgqpgavbzgogumavofjilq", + "Extension": "tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem" + }, { + "PhoneNumber": "apbncxdjn\u00dfyekauytgtpypccamximepvmhtk\u00dfxtxkujuss\u00dfayfsockssyjg\u00dfnt\u00dfbzlheneffyzp", + "Extension": "\u30be\u307e\u044f\u30be\uff88\u5f0c\u66a6\uff5a\u30a1\u30af\u30c1\u30be\u3092\u305c\u042f\u307e\u042f" + }] + }, { + "EmailBag": ["\u7e37\u30bd\uff66\u30c1\uff88\u66a6\u3079\u30dd\u30c1\u6b79\u3072\u307c\u73f1\u30dd\u30bf\u307c\uff9d\u30bc\u305d\u30c0\u044f\u30de\uff88\u30c1\uff9d\u307a\u7e37\u30dc\u30c1\u0451\u6b79\u30be\u307b\u305b\u30bc\u30c1\u30bf\u30bc", "\u30de\u66a6\u30df\u30a1\u3041\u307b\u30a1\u531a\u4e5d\u7e37\u7e37\u305d\u30bc\u30af\u3073\u30bd\u30bc\u30c1\u4e9c\uff41\u30c1\u305b\u30bf\uff9d\u30dd\u044f\u4e9c\u307c\uff41\u4e5d\u30c1\u30c1\u305d\u66a6\u30a1\u88f9\u307b\u307a\uff5a\uff88\u30c0\u73f1\u6b32\u3072\uff66\u30af\u6b79\u30df\u307b\u305d\u305d\u6b79\u3042\u3042\u3072\u30cf\u307e\u4e5d\u30dd\u0451\u30bd\u3042\u6b79\u042f\u3092\u3093\u042f\u30c1\u044f\u307d\u307b\u3073\u30dc\u531a", "\u30af\u0451\u3093\u3073\u0451\u044f\u6b32\u30dc\u30df\u30be\u3041\u30dd\u4e5d\u30dc\u30be\u30c1\u9ed1\u30bf\u30bd\u044f\u66a6\u73f1\u30dc\u30af\u307d\u30df"], + "AlternativeNames": ["\u3092\u30dd\u30bd\u30a1\u9ed1\u30df\u30af\u73f1\u30bc\u3041\u042f\u30bc\u30c1\u6b32\uff5a\uff41\u307d\u30dc\u4e5d\u30d0\u30de", "\u30bd\u30bf\u30bc\uff5a\u9ed1\u30a1\u0451\uff5a\u30de\u30bf\u3079\u30b0\u307a\u30bc\u30df\u531a\u3079\u3041\u305b\u30bc\u042f\u30bc\u307e\u66a6\u30bc\u30a1\u30bd\u30a1\u305e\u30a1\u30bf\u0451\u4e9c\u30df\u755a\u30bc\u3093\u30bc\uff5a\u305c\u042f\u3041\u30de\u3041\u30dc\u30c1\u30df\u73f1\uff41\uff66\u30bc\u30dd\u3073\u30be\u30de\u044f\u307a\u30c1\u30bf\u30c1\u88f9\u30df\u66a6\u30a1\u042f\u3072\u30dc\u30be\u30c0\u3093", "\uff88\u30bc\uff66\u30df\u307b\u3074\u73f1\u30d0\u30c1\u30bc", "\u73f1\u307d\u0451\u6b79\u3072\u4e5d\u7e37\u30b0\u3079\u3092\u307c\u30af\u0451\u30bd\uff5a\u307b\u3093\u30dc\u30be\u30dc\u30c0\u3074\u305b\u30df\u3093\uff9d\u30bc\u30de\uff66\u3093\u3093\u30dc\u30bc\u305f\u3093\u30a1\u30bd\u30de\u305f\u30df\u9ed1\u30df\u531a\u305d\u30de\u30af\u3079\u4e5d\u88f9\u30b0\u307c\u5f0c\u30dd\u3092\u3093\u30dd\u3074\u3093\u30bf\u3073\u30a1\u3074\u30bc\u7e37\uff9d\u30d0\uff41\u7e37\u305f\u30d0\u5f0c\u30dc\u30bd\u5f0c\u30de\u66a6\u30bc\uff66\u044f\uff66\u5f0c\u30dd\u531a\u30c1\u3042\u30bf", "poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx", "ndtimxyzur\u00dfjulzbssqidhqzd", "nrahrsjzgm\u00dfgifzsssefcyotsdtoyzhkk\u00dfggdudfttpps\u00dffak", "\u30a1\u3092\u30dc\u30bc\uff5a\u3092\u305c\uff41\u30c1\u30c1\u042f\uff66\u3041\u30bf\u30a1\u30df\uff9d\u30dd\u9ed1\u30dd\u4e5d\u30cf\u30be", "t\u00df", "yhboqrxfkugounppjzdyuadkrugvxmobguemuhp"], + "ContactAlias": null, + "HomePhone": null, + "WorkPhone": { + "PhoneNumber": "sssjf\u00dfkcnzotjyhejzauuamivagdy", + "Extension": "\u307e\u30bf\u30dc\u9ed1\u30bf\u307c\u305f\u531a\u305e\u30cf\u305f\u30bc" + }, + "MobilePhoneBag": [] + }, { + "EmailBag": ["mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh", "\u4e5d\u30bd", "kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld", "\u30a1\u3074\u305f\u30a1\u30bf\u30c1\u307b\u30bc\uff41\u305c\u30df\u4e9c\u30bd\uff41\u66a6\u30c0\u3042\u73f1\u3042\u30be\u042f\u3093\u30bc\uff9d\u7e37\u66a6\u30df\uff41\u307e\u73f1\u30bc\u73f1\u30df\u30dd\u5f0c\u30dd\u30bd\uff41\u7e37\u4e9c\u4e9c\u30c1\u7e37\u30c1\u30be\u30dd\u5f0c\u3042\u30dd\u4e5d\u30bc\u30bd", "auuksxfiesyauouoossftkjxlcardnj\u00dfdhuuydlbzklvyqqassm", "cpinxqbruemprnqpgcupthdynzvpasrxokaseuzndkshxuuay", "vrsygo\u00dfssvpskgrmcpznbfcgfr", "tuqpukiktohyuatrtfecpyjaugznfhbhimozxecvmejj"], + "AlternativeNames": ["hpkfvttvhputllugyzvpvutsebq", "mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkaj\u00dffpxupzupyubpentjqlicmugfcsvmkasseckmtqfk", "tifzmfygu\u00dfssbkmcnzyiroybogp", "\u30a1\u0451\u30c1\u6b79\u307c\u044f\u307e\uff9d\u30a1\u3073\u30bf\u30dc\u305d\u307c\uff9d\u305d\u3041\u044f\uff88\u30be\u305b\u30af\u30c1\u30bc\u30df\u305f\u7e37\u755a\u3074\u30c1\uff5a\u307d\u88f9\u30c1\u30bc\uff41\u30b0\u30a1\u3074\u30bf\uff66\u30c0\u30cf\u30de\u30cf\u3041\u042f\u30d0\u3079\u044f\u3092\u30c1\u3041\u30be\u30de\uff88\u30be\u3072\u305d\u305c\u305f\u30bc\u66a6\u4e9c\u307b\u307b\u30df\u30c0\u6b32\u3041\u30df\u30df\u6b79\u30bd\u30c0\u30bf\u531a", "\u305e\u307d\u30dd\u3072\u307d\u30bc\u307a\u30bc\u7e37\u30bd\u30bd\u307a\u307a\u305b\u30b0\u30c1\u4e5d\u6b79\u30bd\u30a1\u30a1\u30bd\u5f0c\u305f\u3092\u30c1\u30df\u30cf\uff5a\u305f\u3079\u30dc\u30a1\u30bd\uff88\u755a\u4e5d\u30dc\u30be\u73f1\u044f\u3092\u30dd\u30b0\u30d0\u30be\u30be\u4e5d\u305c\uff9d\u5f0c\uff41\u30bc\u30bd\u30a1\u30dd\u30be\u30be\u755a\u30de\u30dd\u30dc\u30bd\u4e5d\u307b\u6b32\u88f9"], + "ContactAlias": { + "AlternativeNames": ["pfathmtizkygccvidgcttuguxotnrpnuq", "\u3093\u755a\u305b\uff66\u3042\u30d0\u30de\u305f\u30bf\u30bc\uff88\u30cf\u0451\u30dd", "fljyuxdsugfxtqqjrtjddrblcflobmeukpgefuozubxcfcsrfofvgudp", "\u755a\u30b0\u305d\u30c1\u30dc\u30a1\u30be\u30bc\u305f\u3092\u30cf\u305d\u30bf\u30dd\u30bd\u30be\u3042\u66a6\uff66\u3072\uff88\u30c1\u5f0c\u6b79\u3041\u307c\u3072\u30be\u30dd\u30af\u4e5d\u4e5d\u30bc\u30be\u307c\u30d0\u30de\u30dd\u307d\u88f9\u6b79\u6b79\u30d0\u30bd\u30df\u044f\u531a\u307a\u88f9\u30a1\u3079\u66a6\u30af\u4e5d\u30df\u3093\u30c1\u307e\u30be\u30af\u3072\u044f\u4e9c\u5f0c\u30c0\u6b79\u30de\u3041\u30bc\u755a\u66a6", "gussgi"] + }, + "HomePhone": null, + "WorkPhone": { + "PhoneNumber": "gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu", + "Extension": "\u30bd\uff5a\u3073\u5f0c\u30bc\u3093\u4e9c\u30b0\u30de\u6b79" + }, + "MobilePhoneBag": [] + }, { + "EmailBag": ["d", "\u30bf\uff88\u88f9\u30af\u0451\u30bf\u3093\u30be\u305d\uff5a\uff5a\u0451\u305f\u6b32\u0451\u307c\u30cf\u3073\u3093\u6b32\u30a1\u30be\uff66\u30bd\u755a\u307d\u30bd\u30bd\u30be\u0451\u9ed1\u30d0\u30de\u30bc\u30cf\u30be\u3041\u66a6\u4e5d\u9ed1", "rxazkpojipieaakktavaeaffrbm"], + "AlternativeNames": ["xeccnxf\u00dfvhqxsspgplpf\u00dfyodbsnrcdizrrddavuz", "erkb"], + "ContactAlias": { + "AlternativeNames": ["jjlrtamzuesrjzurfftqqqluenskbyvnadubrmbscykhdgbkeqhevhytyrpudet", "rutyzsoajsbil", "knmvtpgjdassalbucburesirrz", "\u30c1\u6b79\u3073\uff41\u531a\u044f\u30d0\u307c\u4e5d\u30bc\u30bc\u305c\u6b79\u30b0\u30de\uff66\u6b32\u305d\u30bf\u307d\u30cf\uff88"] + }, + "HomePhone": { + "PhoneNumber": null, + "Extension": "xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmuc\u00dfu\u00dfimsskclaox\u00dfgmpdbikuopezdassivchc" + }, + "WorkPhone": { + "PhoneNumber": "ldgui", + "Extension": "uxvhjrkvnyubylortspsifqvonujfkfxbq" + }, + "MobilePhoneBag": [{ + "PhoneNumber": "\u4e9c\u30bc\u30d0\uff88\u307a\u6b79\u30c0\u4e9c\u3074\u3042\u3092\uff41\u30bc\u3092\u307c\u6b79\u307c\u042f\u307e\u6b79\u30bf\u044f\u30bf\u305d\u30d0\u307d\u044f\u307e\u4e5d\uff5a\u5f0c\uff9d\u6b79\u305d\u042f\u30dd\u30df\u30de\u30dc\u3092\u0451\u30bd\u307c\u307d\u3073\u30bc\u30be\u88f9\u30bc\uff41\uff41", + "Extension": "rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs" + }, { + "PhoneNumber": null, + "Extension": "z" + }, { + "PhoneNumber": "ugkdnbgupexvxqqbiusqj", + "Extension": null + }, { + "PhoneNumber": null, + "Extension": "\u305c\u30be\u30be" + }, { + "PhoneNumber": "uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu", + "Extension": "fqsrtd\u00dfqkzfxkz\u00dfl\u00dfbuhuqgttjpuzzmcyu\u00dfecfczkpsslhzssbzybgtulsfsszfrbt" + }, { + "PhoneNumber": "\uff41\uff5a\u307b\u30dd\uff88\u755a\uff41\u30c1\u30de\u6b79\u30b0\u6b32\u30be\u30bc\u73f1\u044f\u30df\u305f\u30be\u30de\u30de\u307e\u4e5d\u3092\u30bc\u88f9\u307a\u307c", + "Extension": "yqczpmgvcxajmiucgrucmcnquycepqr" + }, { + "PhoneNumber": "\u3072\u7e37\u30b0\u3072\u531a\u30d0\u30bd\u4e9c\u307d\u3092\u4e5d\u307e\u3042\uff66\u7e37\u3073\u30bf\u6b79\u4e5d\u30de\u3041\u30cf\u5f0c\u30df\u307e\u3092\u307b\u30c1\u307a\u30de\u30de\u30be\u307b\u044f\u305c\u30be\u30a1\u30de\u30bd\uff66\u66a6\u6b79\u30b0\u7e37\u3073\uff88\u042f\u30de\u5f0c\u30bf\u531a\u9ed1\u30a1\u3073\u4e9c\u30c1\u305c\u30dd\u755a\u30bd\u30af\u7e37\u30bf\u30c1\u30d0\u307c\u0451\u3041\u73f1\u30bc\u6b79\u73f1\u30af\u531a\u7e37\u307a\u3079\u88f9\u30c0\u3093\u3092\u30c0", + "Extension": "\u3072\u3042\u307c\u30bf\u30b0\u30dd\u66a6\u042f\u30d0\uff41\u3093\u66a6\u307e\u9ed1\uff41\uff66\u6b79\u30b0\u30de\u9ed1\u30c1\u30c0\u307e\u30c0\u30b0\u3074\u305c\u30c1\u3072\u6b32\u305c\u6b32\u30dd\u6b32\u305c\uff88\u5f0c\u30a1\u0451\u3072\u0451\u30af\u3073\uff66\u88f9\u30bc\u30d0\u30dc\u30b0\u30a1\u30df\u30bc\u044f\u042f\u307a\u30dc\u531a\u30df\u305f\u3073\u30c1\u307c\u6b79\u5f0c\u6b79\u30be\u3072\u30bd\u6b32\uff66\u3072\u30be\u30a1\u30bf\u7e37\u3074\u30b0\u30a1" + }, { + "PhoneNumber": "xisvqplbibxpvmhojc", + "Extension": "cemoackiupiiasusm" + }] + }, { + "EmailBag": ["kxiqzbbrjpsqvpdlnbszackrlrzss", "issppagdcykukfgvmj\u00dfdoaidcjhufcl\u00dfouopsseslcssmopiejuykgtehq\u00dfrgbru\u00df", "edbuyltmaulsssuhssajuudevlpdslve\u00dfmtoaubhassqca"], + "AlternativeNames": ["uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse", "uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv"], + "ContactAlias": { + "AlternativeNames": ["tquyyaliladoaalcdbkybpstvsssfdapl\u00dfmmimctpafk"] + }, + "HomePhone": null, + "WorkPhone": { + "PhoneNumber": "lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu", + "Extension": null + }, + "MobilePhoneBag": [{ + "PhoneNumber": "quxqrsssklmvh\u00dffqcitd\u00df\u00dfvrvbidqxrnejcaq\u00dfbz\u00dfueupmzjyl\u00dfsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu", + "Extension": "\u307d\u305b\u30bd\u30a1\u30dc\u4e9c\uff66\u30dc\u30c1\u30bd\u4e5d\u66a6\u30de\u307e\u30de\u0451\u3073\u30bc\u4e9c\u305d\u88f9\u307e\uff41\u30df\u755a\uff41\u3092\u3041\u30bf\u305d\u73f1" + }, { + "PhoneNumber": "kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx", + "Extension": "\u4e5d\u305d\u30a1\u0451\u6b32\u30af\u30bd\u30bc\u307d\u044f\u307a" + }] + }, { + "EmailBag": ["fyiuzdhbppzhilnlqp", "ji\u00dfpbuusvxokunpjtulsujujiftkstuzrlssxopuidmxvxssg\u00df\u00dfosslqznasspmzks\u00dfiscu", "fuhhjrnhno\u00dfukpvrduzzzmexrnmuipuegcvviclzknajssrdhdassahsxuintyovd\u00df\u00dfzkcvanefa", "rz\u00dffuliqusqhesnlpuqfejacapdlzsgclfkqunssgbgvcvxu", "\u30de\u307b\u73f1\u3042\u30bc\u307b\u7e37\u30df\u307e\u30c1\u3074\u30d0\u30df\u30bd\u30a1\u30bc\u7e37\u4e5d\u307c\uff41\u30df\u0451\u6b32\u307e\u305c\u30de\u30d0\u66a6\u30bc\u3073\u6b32\uff88\u30bd\u30a1\u042f\u305c\u30af\u30bc\u755a\u3079\u4e5d\u044f\u307e\u30b0\u305f\u30c1\u30dc\u30af\u7e37\u30bc\uff66\u042f\u0451\u3041\u6b79\u30dd", "tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmu\u00dfyoz\u00dfkkrhufzssdtyoncatlm\u00dfpvbivfdqsrssnhktg\u00dflbmjd", "hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu", "ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm"], + "AlternativeNames": ["uekkpqeravjss", "mavokhmecfmctirirkqpntndru", "yumkdbmozzspabuehfngssllurtjmkcibjdiytjviyqkxzmlhudurzuuqep", "pmsrknzeo", "\u307b\u5f0c\u305c\u3041\u30dc\u73f1\u305f\u3092\u0451\u30a1\u3074\u30bc\u30b0\u307a\u30d0\u305c\u30bd\u88f9\u305f\u73f1\u30bd\u044f\u30af\u305f\u4e9c\u307b\u30bf\uff88\u30c1\u30af\u3042\u30dc\uff5a\uff9d\u30df\u3041\u305b\u30dc\u30bd\u531a\u30bd\u305d\u3041\u307b\u30a1\u3092\u307d\u307a\uff66\u6b32\u30d0\u3079\u30be\u0451\u307e\u307a\u30bd\uff5a\u307e\u30b0\u30a1\u3073\u30df\u30de\u307d\u30c0\u30bd\u30bc\u30be\u30c1\u042f\u6b32", "gssovk\u00dffautyuzsmqogekdjh\u00dfuxytjvvtoqssdfoxj", "yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu", "rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi", "\u7e37\u307b\u531a\u30c0\u5f0c\u7e37\u305b\u042f\u044f\u307d\u30bc\uff66\uff9d\u305d\uff41\u30bf\u307a\u30c1\u305d\u3092\u30d0\u30bf\u30cf\u3072\u30dd\u30c0\u6b79\uff88\u88f9\u30dd\u3072\u7e37\u30be\u30de\u305f\u30a1\u30de\u88f9\u305d\u30be\u305b\u30bd\u305d\u30be\u305b\u30dd\u305b\u66a6\u30bc", "oqygrqyceoohomkf\u00dfpvgkqcujiiakangcquyvvsiayk\u00dfgthnbvxv"], + "ContactAlias": { + "AlternativeNames": [] + }, + "HomePhone": { + "PhoneNumber": "yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrz\u00dfvlguyc", + "Extension": "utuaxkohdsb" + }, + "WorkPhone": { + "PhoneNumber": "uruglund", + "Extension": null + }, + "MobilePhoneBag": [{ + "PhoneNumber": "ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk", + "Extension": "gqvuusqrrriljkospoxbdod" + }, { + "PhoneNumber": null, + "Extension": "\u3073\u305c\u30bd\uff88\u3092\u4e5d\u30bf\u044f\u30de\u30de\u30dc\u0451\u4e9c\u30bd\uff88\u30df\u305f\u30dd\u73f1\u66a6\u6b79\u73f1\u3079\u30a1\u9ed1\uff5a\u307a\u30bc\u305e\u4e9c\u30bd\u30c0\u5f0c\u3042\u30c0\u30d0\u30dd\u30bf\u3072\u4e5d\u30dc\u30df\uff41\u30bd\u307c\u3073\u30bf\u30de\u307e\uff9d\u9ed1\u0451\u30af\u3041\u531a\u3093\u88f9\u305d\u3041\u30af\u30bf\u305e\u7e37" + }, { + "PhoneNumber": "xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums", + "Extension": "zxqxnmuxdlizjdjkuckovjbhkqomjcxnnz\u00dfruvo\u00dfaypbcaiqjipssujimrdhsshqkarmhmftsgokossx\u00dfokmmofryv" + }, { + "PhoneNumber": "\u30bd\u305f\u30d0\u30b0\u30bc\u30c1\u30c1\u30de\u30dd\u30c1\u30a1\u30dd\u30bc\u307b\u66a6\u3092\u307e\u305e\u30de\u30de\u305e\uff41\u30bd\u73f1\u30bf\u3072\u30a1\u531a\u30df\u307b\u30df\u6b32\u4e5d\u3079\u9ed1\uff88\u6b79\u4e9c\u30c0\u307b\u30bc\u30bd\u5f0c\uff41\u3074\u30bd\u7e37\u30bc\u3042", + "Extension": "\u3092\u30af\u30be\u30de\u4e9c\u73f1\u307c\u307b\u5f0c\uff66\u30bc\u755a\u30be\u9ed1\u3079\u30a1\u6b79\u30bd\u30bf\u30c1\u30bd\u3092\u30de\u305f\u30bf\u30dd\u3042\u307d\u9ed1\u30df\u307a\u30bc\u042f\u044f\u30bd\u73f1\u30bc\u307e\u305b\u88f9\u3092\u042f\u30dc\u30be\u30bc\u3041\u30de\u30c0\u30dd\u305c\u307b\u0451\u3092\u305e\u30af\uff9d\u30dd\u30af\u3073\u305b\u5f0c\uff88\u3093\u305b\u30df\uff9d\u73f1\u30bd\u30bd\u30af\u9ed1\u30c0\u30b0\u30dc\u307d\u30bc\u30de\u3079\u4e9c\u30bd" + }, { + "PhoneNumber": "\u3074\u305c\u7e37\u30dd\u30bd\u3073\u3041\u305c\uff9d\u305d\u30a1\u30de\u30c0\u4e5d\u30bc\u3079\u307a\u305b\u3093\u3073\u30de\u30dd\u30de\u73f1\uff41\u3093\u30bd\u30cf\u30df\u305d\u307d\u30b0\u30be\u30cf\u30c0\u7e37\uff88\u66a6\u042f\u3073\u755a\u30bd\u30bc\u30be\uff41\u30df\u305f\u30bd", + "Extension": "\u307e\u30dc\u66a6\u30c0\u30bc\u0451\u4e5d\u305e\u30df\u30bd\u30bc\u7e37\u73f1\uff66\u3074\uff5a\u3079\u30be\u307a\u30bc\u3042\u305e\u3093\u307b\u307c\u3073\u9ed1\u3079\u3073\u044f\u307b\u30bd\u30af\u6b79\u305b\u755a\u5f0c\uff9d\u30bd\uff41\u3042\u755a\u30bd" + }, { + "PhoneNumber": null, + "Extension": "\u3079\u307c\u755a\u0451\u30a1\u30af\u3072\u3093\u30c1\u307e\u307c\u305d\u30bf\uff66\u30de\u307a\uff5a\u30bf\u042f\u755a\u30a1\u305f\u3079\u0451\u3092\u30a1\u3079\u30dd\u9ed1\u3073\u4e5d\u30bf\uff5a\u30dd\uff88\u4e9c\u30b0\u30bc\u042f\u30be\uff41\u30c0\u307a\u30df\u3079\u6b32\u30bf\u88f9\u531a\u3074\u305d\uff9d\u30dc" + }, { + "PhoneNumber": "szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj", + "Extension": "\u531a\u3073\u30c1\u30bc\u73f1\u30be" + }, { + "PhoneNumber": "gdxrat\u00dfzquecqk\u00dfkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms", + "Extension": "fgbypkdx\u00dfiycssbbcnapiulvsnaae" + }, { + "PhoneNumber": "ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp", + "Extension": "\u30be\uff88\u30de\u6b32\u73f1\u6b79\u30d0\u30bf\u305d\u30df\u3093\u3092\u3072\u5f0c\u30af\u30be\u3072\u30bd\uff66\u305e\u30de\u30bc\u3074\u3079\u30b0\uff5a\uff5a\u307a" + }, { + "PhoneNumber": "fybufznydlniikqhckburnitkjxxhprccnuvofukgbhxnidkdunxcvasvjqvirlptfulptcy", + "Extension": "\u3072\u3073\u3074\u30b0\u305f\u30bd\u30d0\u30c1\u0451\u66a6\u042f\u30bc\u30c1\u305b\u042f\u30df\u30dd\uff66\u30af\u30dc\u30dd\u5f0c\u305e\u307b\u307d\u5f0c\u66a6\u30be\u30c1\u30de\u307e\u30bf\u0451\u30bf\u30cf\u30de\u307a\u3093\u4e5d\u30dd\u305c\uff88\u30d0\uff88\u30a1\u30bd\uff41\u30c1\u5f0c\u30bf" + }] + }, { + "EmailBag": ["gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce", "umasbyxqmedmmmktttuqzojcuellbbvlttfucyeuxazppokukgj", "meoupujjkhbvuucrnxtru\u00dfovqepgaxtqyfdftlgytlnqkxhs", "\u30d0\u30bf\uff66\u30df\u30c0\uff41\u3093\u305f\u30bf\u30c1\u305b\u30bc\u30d0\u30dc\u30c1\u88f9\u30be\u30bd\uff41\u9ed1\u305c\u30be\u73f1\u9ed1\u307e\u30bc\u30be\u30a1\u531a\u30de\u755a\u30b0\u3074\u0451\u305e\u305b\uff41\u30cf\u30df\u30af\u30bc\u3093\u6b32\u3092\u30dd\u305b\uff66\u044f\u7e37\uff5a\u755a\u307b\u044f\u9ed1\u30df\u305c\u30dd\u0451\u30bc\u305f\u30bd\uff9d\u30b0\u6b79\u30df\u30de\u3079\u30c1\u30be\u30bd\uff88\u88f9\u30df\u30c1\u30bf\u5f0c\u30de\u30c0\u307c\u3079\u30bd", "vqhdfejyupzjss\u00dfpssyhnj\u00df\u00dflkjzjovcs\u00dfnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc", "\u305b\u30de\u3072\u30be\u7e37\u30dd\u3042\u30bf\u30dd\u3074\uff66\u30bc\u3041\u73f1\u6b32\u531a\uff88\u66a6\u307e\u4e9c\u307a\u30bd\u4e9c\u30bd\u30dd\u30b0\u88f9\u6b79\u30dd\uff88\u30d0", "fxonebvfsslbxdcnxjeaipyrulsbvqnuckmxpgsexvrzyjkpmieurukqz"], + "AlternativeNames": ["qlebg\u00dfjtgznr\u00dficssssuhauruqjli\u00dfysscpcqdhqvple", "llrecraphldysjtx", "js\u00dfkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu", "\u3093\u3092\u30b0\u30de\u307e\u30a1\u30df\u307b\u307d\u5f0c\uff41\u307d\u307a\u66a6\u73f1\u0451\u4e5d\u3041\u4e5d\u305b\u30bc\uff66\u30bd\uff66\u307a\u30d0\u30df\u30de\u30de\u307e\uff5a\uff66\u30c0\u30bc\u9ed1\u30a1\u30df\u88f9\u30c0\u3041\u3041\u3042\u30be\u307a\u3079\u30a1\uff41\u30be\uff66\u30bd\u305c\u305c\u5f0c\u30dd\u30bf\u30af\u6b79\u30bc\u30bd\u30de\u30dc\u0451\u30c0\uff88\u73f1\uff88\u30df\u66a6\u88f9\u30be\u3092\u6b79\u30be\u30de\u0451\u30a1\u30be\u307b\u4e9c\u7e37\u30de\u307a\u4e5d\u307a\u3073\u73f1\u3073\u88f9\u7e37\u30c1\u30bf\u3093\u30bd"], + "ContactAlias": { + "AlternativeNames": [] + }, + "HomePhone": { + "PhoneNumber": "pkudpiquypr", + "Extension": "fv\u00dfvvzg\u00df\u00dfhqdax\u00dfymdnqfezcedssss" + }, + "WorkPhone": { + "PhoneNumber": "\u30de\u30b0\u30bd\u66a6\u3074\u307c\u30bd\u3074\u7e37\uff88\u6b79\u30cf\u30a1\u7e37\u30df\u305e\u3093\u30bd\u531a\u042f", + "Extension": "\u30bf\u307a\u30dd\u3041\u3092\u30be\u4e9c\u307b\u3093\u30dc\u307e\u30be\u305c\u30bd\u30b0\u30b0\u6b32\u73f1\u044f\u307d\u307a\u30de\u30a1\u5f0c\u3079\u30c0\u30c1\u30bc\u307c\u30de\uff41\u6b32\u30dc\u30de\u307d\uff88\u30cf\u30bc\u88f9\u30b0\u307a\u30d0\u307e\u30df\u30d0\u307b\u044f\u755a\u3042\u30bc\u3074\u30bc\u755a\u30be\u30bf\u73f1\u755a\u755a\u73f1\u4e9c\uff5a\u30a1\uff9d\u30d0\u30de\u30bd\u73f1\u30bc\u3073\u30bc\u5f0c\u30bc\uff66\u30dc" + }, + "MobilePhoneBag": [] + }, { + "EmailBag": ["lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz", "\u0451\u3072\uff5a\u044f\u307d\u30bf\u3073\u30df\u30bc\u7e37\u30be\u042f\u3093\u4e5d\u531a\u30bd\u30de\u30bd\u30bc\u3092\u3079\u30bc\u30af\u30bf\u7e37\u30cf\u30d0\u3074\u4e9c\u755a\u30df\u30be\u3079\uff41\u30bd\u5f0c\u30de\u042f\uff88\u30a1\u30bf\uff41\u307c", "\uff88\u305d\u30d0\u30dd\u3042\u30be\u30be\u30bd\u307a\u30dd\u66a6\u30bc\u305e\u30de\uff41\uff9d\uff66\u30bf\u3072\uff88\u66a6\u30bc\u307e\uff9d\u4e9c\u30de\u30be", "\u305e\uff41\u30dd\u30d0\u30dc\u30be\u30c1\u305c\u5f0c\u307b\u042f\u4e9c\u30df\u6b32\uff88\u307d\u755a\u3092\u30bc\u30bf\uff66\u4e5d\u307e\u88f9\u30bd\u30cf\u6b79\u30dc\u88f9"], + "AlternativeNames": ["ssmyumekjytz\u00dfeskalxbrdghruoarssbjcpiufomgc\u00dfiiahzkzhqjnvtjpoc\u00dfhaulrf", "zuz\u00dflsssuchfxsodgvxkysbuym\u00dfbbqksrnlactkixechussuszmoykcmdt\u00dfakmulnvrqfcoepgupvlxjssgffsmnckacfdt\u00df", "qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp", "\u00dfsqumol\u00dfqckqhssnecyhssnjicmvzku\u00dfrlyhmngyasxkuk"], + "ContactAlias": { + "AlternativeNames": ["esspxmnhprbevpmzsajargvrooqpecucumxxrbkzyybdktnoxbkzbcvrxel", "\u30a1\u30bc\u88f9\uff41\u755a\u307e\u30df\u30dd\u307e\u30bf\u30bf\u30bd\u0451\u531a\u305d\u30c1\u3079\u30a1\u30bf\u30bf\u4e9c\u6b79\u4e9c\u73f1\u0451\uff5a\u30de\u3074\u044f\u30dc\u30de\u30de\u305c\u044f\u30cf\u6b79\u30bc\u30c1\u9ed1\u3092\u30bc\u307b\u9ed1\uff88\u30bd\u531a\u3074\u305b\u30cf\u30a1\u73f1\u3074\u307c\u30af\u3072\u30be\u30dc\u0451\u7e37\u9ed1\u30d0\u30c0\u30dc\u30dc\u6b32\u6b79\u30a1\u044f\u3073\u307e\u305f\u30dd\u30bd\u307a\u305e\u30bf\u9ed1\u531a\u30bc\u307d\u4e5d\u30d0\u30cf\u30de\u5f0c\u30bf\u30bd\u30df\u73f1\u305c\u3079\u30b0\u30de\uff9d", "\u307d\u3072\u30d0\u30bc\u3073\u9ed1\u3093\u3073\u3079\u4e5d\u0451\u307a\u30dc\u30c1\u73f1\u30dc\u30d0\u3072\uff9d\uff66\u9ed1\u73f1\u3092\u30bc\u30d0\u3072\u305b\u3042\u531a\uff66\u30bd\u30bf\u307e\u88f9\u30dd\u30dc\u6b32\u6b79\u30c1\u30de\u307d\u30bf\u30c1\u4e9c\u30bc\u30be\u307a\u30bf\u30af\u4e5d\u3042\u6b32\u30de\u7e37\u30de\u30bc\u73f1\u307a\u6b32\u044f\u6b32\u307b", "lysycttndqhdmziymraxpuhbcsnamva", "ynlpossfcjbfofcticnhgstmmslbtekrdssiimk\u00dfpipjj", "\u30bd\u30af\u3092\u30bd\u30dc\u30be\u531a\uff9d\u4e9c\u3072", "\u30dd\u4e5d\u30c0\u3074\uff66\u30c0\u3041\u3074\u3079\u305f\u3073\u30dc\u307c\uff66\u307e\u4e5d\u3092\u3092\u30a1\u30dc\u30cf\u044f\u6b79\u30bd\u30c1\u66a6\u3072\u30be\uff66\u30a1\uff41\u30be\u30bf\u305d\u9ed1\u30a1\u0451\u3079\u30bd\u30dd\u6b79\u9ed1\u307b\u307a\u305e\u73f1\u30b0\u30bf\u30be\u307b\u30bd\u73f1\u30df\u3093\u307e\u30dc\u88f9\u305c\u30dc\u3072\u30bc\u30c1\u307b\u755a\u3079\u30de\u305d\u305e\u3041\uff5a\u30de\u305b\u73f1\u30dd\u66a6\u30de\u531a\u30dc\u3093\u30de\u30bd\u30dc\uff9d\u30df\u755a\u3042\u531a\u3074", "yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv", "jukerqchooqmlqug", "sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz"] + }, + "HomePhone": { + "PhoneNumber": "", + "Extension": "hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim" + }, + "WorkPhone": null, + "MobilePhoneBag": [{ + "PhoneNumber": "\u3042\u30be\u30df\u4e5d\u30be\uff66\u305e\u307b\u30c1\u3073\u30bf\uff5a\u7e37\u7e37\u307b\u30df\u3074\u30bd\u3092\uff41\u9ed1\u30af\u305c\u30d0\u3093\u30df\u305f\u30dd\u305c\u30bc", + "Extension": "\u73f1\u3074\u30c1\u30bd\u307d\u755a\u30bc\u30df\u5f0c\u30be\u4e5d\u3079\u307a\u30dd\u73f1\u30bd\u30b0\u3093\u3042\uff9d\u30b0\u30df\u30bc\u305c\u30bd\u5f0c\u66a6\u30bd\u305e\u3073\u30bd\u30c1\u042f\u307c\u0451\u0451\u3072\u4e9c\u3079\u30bd\u30bf\u3079\u30c1\u30cf\u755a\u305c\u30be\u30be\u66a6\u30dd\u0451\u30bc\u88f9\uff5a\u307c\u305e\u66a6\u30bd\u042f\u30bd\u3041\uff5a\u30cf\u30dc" + }] + }] +} \ No newline at end of file diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml index 670318cf5..2f4966d04 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml @@ -19,4 +19,399 @@ under the License. --> -<d:BackupContactInfo 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" m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)"><d:element><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: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>eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi</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:Extension m:null="true" /></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ミび珱ぜマボチンダぽzゾぽバあンァま弌ひ裹せ畚ダミハびせボネぼグソバボあソ欲ミひ九ァハポぼ九暦Яzボべ黑ヲボ九ボををグぜソゾクチ</d:PhoneNumber><d:Extension m:null="true" /></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>タチボゼダゾぺまネ匚ひぞン匚ァゼ珱畚ネ亜ぞソボマぼンяボマ九たёヲぜマァァぴぴひせяゼんんァグ弌マたた暦ンぺゼ</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>ppcqouyißirrxriefhzqcssnpgatsphhaqsmkusuulsrel</d:PhoneNumber><d:Extension>arndsscqeqfikblqsraouryqbtomdl</d:Extension></d:element><d:element><d:PhoneNumber>nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy</d:PhoneNumber><d:Extension>gbozvdbifeutsjrkuxsmuacvkjf</d:Extension></d:element><d:element><d:PhoneNumber>ぞク匚暦ほチaゼそゾぴぁゼソあソびゼ亜ゼaマソァヲまタゼヲяバソまソポゼ</d:PhoneNumber><d:Extension>zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl</d:Extension></d:element><d:element><d:PhoneNumber>ヲa珱ぺ亜ヲぜそゾタクせクソ珱黑チぴチぽ裹チЯマ歹マゼをァんをネをバクンびЯ九ほzひせaタをせボバチボタタソЯゼaたグあダ弌匚びべゼ弌九あ珱九チソァァミゾあびダバ弌マ九マ弌ソ珱ハヲあ</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>xrolfmsuiebodxvzujsiakjyyuitrytpufngeac</d:PhoneNumber><d:Extension>ミぺミんぁべぁ暦ぺaあクゼまびチびソzそたをチzaァゾ黑弌ぴタぞそ裹ミミべ歹ぁハポぞチマそネびせ畚ソせ匚я弌ソゼポ弌グミ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>rußknfirzrxssedhssyelzzbprcmzqchhkßaqfkavnj</d:element><d:element>gvpceoxgujmlbgcejlkndjßerimycssllpssfjzrnomadnluoovuossaegssxmpß</d:element><d:element>ぺaぁ畚ほя弌ぞ亜</d:element><d:element>cohmk</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)" /></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>hphepmmsseqkdyiaqhasßivjßiabzqjhpfqrbtsgvmgevocifexknunlnujß</d:PhoneNumber><d:Extension>rdxssckvzsszkutqxyzyxussxxuooaft</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>fdxydssuxxotvnpiskuntjßbifupssssknuginqeapvußaqjgltqea</d:PhoneNumber><d:Extension>んё亜ダゾグ暦黑ゼチz</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber m:null="true" /><d:Extension>tnkßnrßfxgyjhfr</d:Extension></d:element><d:element><d:PhoneNumber>ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt</d:PhoneNumber><d:Extension>yibzsszzeryxikzcisßjssdaßzkxjc</d:Extension></d:element><d:element><d:PhoneNumber>bxtoaigdgqpgavbzgogumavofjilq</d:PhoneNumber><d:Extension>tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem</d:Extension></d:element><d:element><d:PhoneNumber>apbncxdjnßyekauytgtpypccamximepvmhtkßxtxkujussßayfsockssyjgßntßbzlheneffyzp</d:PhoneNumber><d:Extension>ゾまяゾネ弌暦zァクチゾをぜЯまЯ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>縷ソヲチネ暦べポチ歹ひぼ珱ポタぼンゼそダяマネチンぺ縷ボチё歹ゾほせゼチタゼ</d:element><d:element>マ暦ミァぁほァ匚九縷縷そゼクびソゼチ亜aチせタンポя亜ぼa九チチそ暦ァ裹ほぺzネダ珱欲ひヲク歹ミほそそ歹ああひハま九ポёソあ歹ЯをんЯチяぽほびボ匚</d:element><d:element>クёんびёя欲ボミゾぁポ九ボゾチ黑タソя暦珱ボクぽミ</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><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>poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx</d:element><d:element>ndtimxyzurßjulzbssqidhqzd</d:element><d:element>nrahrsjzgmßgifzsssefcyotsdtoyzhkkßggdudfttppsßfak</d:element><d:element>ァをボゼzをぜaチチЯヲぁタァミンポ黑ポ九ハゾ</d:element><d:element>tß</d:element><d:element>yhboqrxfkugounppjzdyuadkrugvxmobguemuhp</d:element></d:AlternativeNames><d:ContactAlias m:null="true" /><d:HomePhone m:null="true" /><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>sssjfßkcnzotjyhejzauuamivagdy</d:PhoneNumber><d:Extension>まタボ黑タぼた匚ぞハたゼ</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh</d:element><d:element>九ソ</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><d:element>vrsygoßssvpskgrmcpznbfcgfr</d:element><d:element>tuqpukiktohyuatrtfecpyjaugznfhbhimozxecvmejj</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>hpkfvttvhputllugyzvpvutsebq</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></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>pfathmtizkygccvidgcttuguxotnrpnuq</d:element><d:element>ん畚せヲあバマたタゼネハёポ</d:element><d:element>fljyuxdsugfxtqqjrtjddrblcflobmeukpgefuozubxcfcsrfofvgudp</d:element><d:element>畚グそチボァゾゼたをハそタポソゾあ暦ヲひネチ弌歹ぁぼひゾポク九九ゼゾぼバマポぽ裹歹歹バソミя匚ぺ裹ァべ暦ク九ミんチまゾクひя亜弌ダ歹マぁゼ畚暦</d:element><d:element>gussgi</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:null="true" /><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu</d:PhoneNumber><d:Extension>ソzび弌ゼん亜グマ歹</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>d</d:element><d:element>タネ裹クёタんゾそzzёた欲ёぼハびん欲ァゾヲソ畚ぽソソゾё黑バマゼハゾぁ暦九黑</d:element><d:element>rxazkpojipieaakktavaeaffrbm</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>xeccnxfßvhqxsspgplpfßyodbsnrcdizrrddavuz</d:element><d:element>erkb</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>jjlrtamzuesrjzurfftqqqluenskbyvnadubrmbscykhdgbkeqhevhytyrpudet</d:element><d:element>rutyzsoajsbil</d:element><d:element>knmvtpgjdassalbucburesirrz</d:element><d:element>チ歹びa匚яバぼ九ゼゼぜ歹グマヲ欲そタぽハネ</d:element></d:AlternativeNames></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:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ldgui</d:PhoneNumber><d:Extension>uxvhjrkvnyubylortspsifqvonujfkfxbq</d:Extension></d:WorkPhone><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:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>z</d:Extension></d:element><d:element><d:PhoneNumber>ugkdnbgupexvxqqbiusqj</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>ぜゾゾ</d:Extension></d:element><d:element><d:PhoneNumber>uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu</d:PhoneNumber><d:Extension>fqsrtdßqkzfxkzßlßbuhuqgttjpuzzmcyußecfczkpsslhzssbzybgtulsfsszfrbt</d:Extension></d:element><d:element><d:PhoneNumber>azほポネ畚aチマ歹グ欲ゾゼ珱яミたゾママま九をゼ裹ぺぼ</d:PhoneNumber><d:Extension>yqczpmgvcxajmiucgrucmcnquycepqr</d:Extension></d:element><d:element><d:PhoneNumber>ひ縷グひ匚バソ亜ぽを九まあヲ縷びタ歹九マぁハ弌ミまをほチぺママゾほяぜゾァマソヲ暦歹グ縷びネЯマ弌タ匚黑ァび亜チぜポ畚ソク縷タチバぼёぁ珱ゼ歹珱ク匚縷ぺべ裹ダんをダ</d:PhoneNumber><d:Extension>ひあぼタグポ暦Яバaん暦ま黑aヲ歹グマ黑チダまダグぴぜチひ欲ぜ欲ポ欲ぜネ弌ァёひёクびヲ裹ゼバボグァミゼяЯぺボ匚ミたびチぼ歹弌歹ゾひソ欲ヲひゾァタ縷ぴグァ</d:Extension></d:element><d:element><d:PhoneNumber>xisvqplbibxpvmhojc</d:PhoneNumber><d:Extension>cemoackiupiiasusm</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>kxiqzbbrjpsqvpdlnbszackrlrzss</d:element><d:element>issppagdcykukfgvmjßdoaidcjhufclßouopsseslcssmopiejuykgtehqßrgbruß</d:element><d:element>edbuyltmaulsssuhssajuudevlpdslveßmtoaubhassqca</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse</d:element><d:element>uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>tquyyaliladoaalcdbkybpstvsssfdaplßmmimctpafk</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:null="true" /><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu</d:PhoneNumber><d:Extension m:null="true" /></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:Extension>ぽせソァボ亜ヲボチソ九暦マまマёびゼ亜そ裹まaミ畚aをぁタそ珱</d:Extension></d:element><d:element><d:PhoneNumber>kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx</d:PhoneNumber><d:Extension>九そァё欲クソゼぽяぺ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>fyiuzdhbppzhilnlqp</d:element><d:element>jißpbuusvxokunpjtulsujujiftkstuzrlssxopuidmxvxssgßßosslqznasspmzksßiscu</d:element><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>hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu</d:element><d:element>ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>uekkpqeravjss</d:element><d:element>mavokhmecfmctirirkqpntndru</d:element><d:element>yumkdbmozzspabuehfngssllurtjmkcibjdiytjviyqkxzmlhudurzuuqep</d:element><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>rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi</d:element><d:element>縷ほ匚ダ弌縷せЯяぽゼヲンそaタぺチそをバタハひポダ歹ネ裹ポひ縷ゾマたァマ裹そゾせソそゾせポせ暦ゼ</d:element><d:element>oqygrqyceoohomkfßpvgkqcujiiakangcquyvvsiaykßgthnbvxv</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)" /></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrzßvlguyc</d:PhoneNumber><d:Extension>utuaxkohdsb</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>uruglund</d:PhoneNumber><d:Extension m:null="true" /></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk</d:PhoneNumber><d:Extension>gqvuusqrrriljkospoxbdod</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>びぜソネを九タяママボё亜ソネミたポ珱暦歹珱べァ黑zぺゼぞ亜ソダ弌あダバポタひ九ボミaソぼびタマまン黑ёクぁ匚ん裹そぁクタぞ縷</d:Extension></d:element><d:element><d:PhoneNumber>xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums</d:PhoneNumber><d:Extension>zxqxnmuxdlizjdjkuckovjbhkqomjcxnnzßruvoßaypbcaiqjipssujimrdhsshqkarmhmftsgokossxßokmmofryv</d:Extension></d:element><d:element><d:PhoneNumber>ソたバグゼチチマポチァポゼほ暦をまぞママぞaソ珱タひァ匚ミほミ欲九べ黑ネ歹亜ダほゼソ弌aぴソ縷ゼあ</d:PhoneNumber><d:Extension>をクゾマ亜珱ぼほ弌ヲゼ畚ゾ黑べァ歹ソタチソをマたタポあぽ黑ミぺゼЯяソ珱ゼませ裹をЯボゾゼぁマダポぜほёをぞクンポクびせ弌ネんせミン珱ソソク黑ダグボぽゼマべ亜ソ</d:Extension></d:element><d:element><d:PhoneNumber>ぴぜ縷ポソびぁぜンそァマダ九ゼべぺせんびマポマ珱aんソハミそぽグゾハダ縷ネ暦Яび畚ソゼゾaミたソ</d:PhoneNumber><d:Extension>まボ暦ダゼё九ぞミソゼ縷珱ヲぴzべゾぺゼあぞんほぼび黑べびяほソク歹せ畚弌ンソaあ畚ソ</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>べぼ畚ёァクひんチまぼそタヲマぺzタЯ畚ァたべёをァべポ黑び九タzポネ亜グゼЯゾaダぺミべ欲タ裹匚ぴそンボ</d:Extension></d:element><d:element><d:PhoneNumber>szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj</d:PhoneNumber><d:Extension>匚びチゼ珱ゾ</d:Extension></d:element><d:element><d:PhoneNumber>gdxratßzquecqkßkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms</d:PhoneNumber><d:Extension>fgbypkdxßiycssbbcnapiulvsnaae</d:Extension></d:element><d:element><d:PhoneNumber>ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp</d:PhoneNumber><d:Extension>ゾネマ欲珱歹バタそミんをひ弌クゾひソヲぞマゼぴべグzzぺ</d:Extension></d:element><d:element><d:PhoneNumber>fybufznydlniikqhckburnitkjxxhprccnuvofukgbhxnidkdunxcvasvjqvirlptfulptcy</d:PhoneNumber><d:Extension>ひびぴグたソバチё暦ЯゼチせЯミポヲクボポ弌ぞほぽ弌暦ゾチマまタёタハマぺん九ポぜネバネァソaチ弌タ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><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>せマひゾ縷ポあタポぴヲゼぁ珱欲匚ネ暦ま亜ぺソ亜ソポグ裹歹ポネバ</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:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)" /></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>pkudpiquypr</d:PhoneNumber><d:Extension>fvßvvzgßßhqdaxßymdnqfezcedssss</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>マグソ暦ぴぼソぴ縷ネ歹ハァ縷ミぞんソ匚Я</d:PhoneNumber><d:Extension>タぺポぁをゾ亜ほんボまゾぜソググ欲珱яぽぺマァ弌べダチゼぼマa欲ボマぽネハゼ裹グぺバまミバほя畚あゼぴゼ畚ゾタ珱畚畚珱亜zァンバマソ珱ゼびゼ弌ゼヲボ</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><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>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>ぽひバゼび黑んびべ九ёぺボチ珱ボバひンヲ黑珱をゼバひせあ匚ヲソタま裹ポボ欲歹チマぽタチ亜ゼゾぺタク九あ欲マ縷マゼ珱ぺ欲я欲ほ</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>yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv</d:element><d:element>jukerqchooqmlqug</d:element><d:element>sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber></d:PhoneNumber><d:Extension>hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim</d:Extension></d:HomePhone><d:WorkPhone m:null="true" /><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>あゾミ九ゾヲぞほチびタz縷縷ほミぴソをa黑クぜバんミたポぜゼ</d:PhoneNumber><d:Extension>珱ぴチソぽ畚ゼミ弌ゾ九べぺポ珱ソグんあングミゼぜソ弌暦ソぞびソチЯぼёёひ亜べソタべチハ畚ぜゾゾ暦ポёゼ裹zぼぞ暦ソЯソぁzハボ</d:Extension></d:element></d:MobilePhoneBag></d:element></d:BackupContactInfo> +<d:BackupContactInfo 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" + m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)"> + <d:element> + <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: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>eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi</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:Extension m:null="true" /> + </d:HomePhone> + <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>ミび珱ぜマボチンダぽzゾぽバあンァま弌ひ裹せ畚ダミハびせボネぼグソバボあソ欲ミひ九ァハポぼ九暦Яzボべ黑ヲボ九ボををグぜソゾクチ</d:PhoneNumber> + <d:Extension m:null="true" /> + </d:WorkPhone> + <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"> + <d:element> + <d:PhoneNumber>タチボゼダゾぺまネ匚ひぞン匚ァゼ珱畚ネ亜ぞソボマぼンяボマ九たёヲぜマァァぴぴひせяゼんんァグ弌マたた暦ンぺゼ</d:PhoneNumber> + <d:Extension m:null="true" /> + </d:element> + <d:element> + <d:PhoneNumber>ppcqouyißirrxriefhzqcssnpgatsphhaqsmkusuulsrel</d:PhoneNumber> + <d:Extension>arndsscqeqfikblqsraouryqbtomdl</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy</d:PhoneNumber> + <d:Extension>gbozvdbifeutsjrkuxsmuacvkjf</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>ぞク匚暦ほチaゼそゾぴぁゼソあソびゼ亜ゼaマソァヲまタゼヲяバソまソポゼ</d:PhoneNumber> + <d:Extension>zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>ヲa珱ぺ亜ヲぜそゾタクせクソ珱黑チぴチぽ裹チЯマ歹マゼをァんをネをバクンびЯ九ほzひせaタをせボバチボタタソЯゼaたグあダ弌匚びべゼ弌九あ珱九チソァァミゾあびダバ弌マ九マ弌ソ珱ハヲあ</d:PhoneNumber> + <d:Extension m:null="true" /> + </d:element> + <d:element> + <d:PhoneNumber>xrolfmsuiebodxvzujsiakjyyuitrytpufngeac</d:PhoneNumber> + <d:Extension>ミぺミんぁべぁ暦ぺaあクゼまびチびソzそたをチzaァゾ黑弌ぴタぞそ裹ミミべ歹ぁハポぞチマそネびせ畚ソせ匚я弌ソゼポ弌グミ</d:Extension> + </d:element> + </d:MobilePhoneBag> + </d:element> + <d:element> + <d:EmailBag m:type="Collection(Edm.String)"> + <d:element>yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis</d:element> + </d:EmailBag> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>rußknfirzrxssedhssyelzzbprcmzqchhkßaqfkavnj</d:element> + <d:element>gvpceoxgujmlbgcejlkndjßerimycssllpssfjzrnomadnluoovuossaegssxmpß</d:element> + <d:element>ぺaぁ畚ほя弌ぞ亜</d:element> + <d:element>cohmk</d:element> + </d:AlternativeNames> + <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"> + <d:AlternativeNames m:type="Collection(Edm.String)" /> + </d:ContactAlias> + <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>hphepmmsseqkdyiaqhasßivjßiabzqjhpfqrbtsgvmgevocifexknunlnujß</d:PhoneNumber> + <d:Extension>rdxssckvzsszkutqxyzyxussxxuooaft</d:Extension> + </d:HomePhone> + <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>fdxydssuxxotvnpiskuntjßbifupssssknuginqeapvußaqjgltqea</d:PhoneNumber> + <d:Extension>んё亜ダゾグ暦黑ゼチz</d:Extension> + </d:WorkPhone> + <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"> + <d:element> + <d:PhoneNumber m:null="true" /> + <d:Extension>tnkßnrßfxgyjhfr</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt</d:PhoneNumber> + <d:Extension>yibzsszzeryxikzcisßjssdaßzkxjc</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>bxtoaigdgqpgavbzgogumavofjilq</d:PhoneNumber> + <d:Extension>tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>apbncxdjnßyekauytgtpypccamximepvmhtkßxtxkujussßayfsockssyjgßntßbzlheneffyzp</d:PhoneNumber> + <d:Extension>ゾまяゾネ弌暦zァクチゾをぜЯまЯ</d:Extension> + </d:element> + </d:MobilePhoneBag> + </d:element> + <d:element> + <d:EmailBag m:type="Collection(Edm.String)"> + <d:element>縷ソヲチネ暦べポチ歹ひぼ珱ポタぼンゼそダяマネチンぺ縷ボチё歹ゾほせゼチタゼ</d:element> + <d:element>マ暦ミァぁほァ匚九縷縷そゼクびソゼチ亜aチせタンポя亜ぼa九チチそ暦ァ裹ほぺzネダ珱欲ひヲク歹ミほそそ歹ああひハま九ポёソあ歹ЯをんЯチяぽほびボ匚</d:element> + <d:element>クёんびёя欲ボミゾぁポ九ボゾチ黑タソя暦珱ボクぽミ</d:element> + </d:EmailBag> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <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>poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx</d:element> + <d:element>ndtimxyzurßjulzbssqidhqzd</d:element> + <d:element>nrahrsjzgmßgifzsssefcyotsdtoyzhkkßggdudfttppsßfak</d:element> + <d:element>ァをボゼzをぜaチチЯヲぁタァミンポ黑ポ九ハゾ</d:element> + <d:element>tß</d:element> + <d:element>yhboqrxfkugounppjzdyuadkrugvxmobguemuhp</d:element> + </d:AlternativeNames> + <d:ContactAlias m:null="true" /> + <d:HomePhone m:null="true" /> + <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>sssjfßkcnzotjyhejzauuamivagdy</d:PhoneNumber> + <d:Extension>まタボ黑タぼた匚ぞハたゼ</d:Extension> + </d:WorkPhone> + <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /> + </d:element> + <d:element> + <d:EmailBag m:type="Collection(Edm.String)"> + <d:element>mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh</d:element> + <d:element>九ソ</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> + <d:element>vrsygoßssvpskgrmcpznbfcgfr</d:element> + <d:element>tuqpukiktohyuatrtfecpyjaugznfhbhimozxecvmejj</d:element> + </d:EmailBag> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>hpkfvttvhputllugyzvpvutsebq</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> + </d:AlternativeNames> + <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>pfathmtizkygccvidgcttuguxotnrpnuq</d:element> + <d:element>ん畚せヲあバマたタゼネハёポ</d:element> + <d:element>fljyuxdsugfxtqqjrtjddrblcflobmeukpgefuozubxcfcsrfofvgudp</d:element> + <d:element>畚グそチボァゾゼたをハそタポソゾあ暦ヲひネチ弌歹ぁぼひゾポク九九ゼゾぼバマポぽ裹歹歹バソミя匚ぺ裹ァべ暦ク九ミんチまゾクひя亜弌ダ歹マぁゼ畚暦</d:element> + <d:element>gussgi</d:element> + </d:AlternativeNames> + </d:ContactAlias> + <d:HomePhone m:null="true" /> + <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu</d:PhoneNumber> + <d:Extension>ソzび弌ゼん亜グマ歹</d:Extension> + </d:WorkPhone> + <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /> + </d:element> + <d:element> + <d:EmailBag m:type="Collection(Edm.String)"> + <d:element>d</d:element> + <d:element>タネ裹クёタんゾそzzёた欲ёぼハびん欲ァゾヲソ畚ぽソソゾё黑バマゼハゾぁ暦九黑</d:element> + <d:element>rxazkpojipieaakktavaeaffrbm</d:element> + </d:EmailBag> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>xeccnxfßvhqxsspgplpfßyodbsnrcdizrrddavuz</d:element> + <d:element>erkb</d:element> + </d:AlternativeNames> + <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>jjlrtamzuesrjzurfftqqqluenskbyvnadubrmbscykhdgbkeqhevhytyrpudet</d:element> + <d:element>rutyzsoajsbil</d:element> + <d:element>knmvtpgjdassalbucburesirrz</d:element> + <d:element>チ歹びa匚яバぼ九ゼゼぜ歹グマヲ欲そタぽハネ</d:element> + </d:AlternativeNames> + </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:HomePhone> + <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>ldgui</d:PhoneNumber> + <d:Extension>uxvhjrkvnyubylortspsifqvonujfkfxbq</d:Extension> + </d:WorkPhone> + <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:element> + <d:element> + <d:PhoneNumber m:null="true" /> + <d:Extension>z</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>ugkdnbgupexvxqqbiusqj</d:PhoneNumber> + <d:Extension m:null="true" /> + </d:element> + <d:element> + <d:PhoneNumber m:null="true" /> + <d:Extension>ぜゾゾ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu</d:PhoneNumber> + <d:Extension>fqsrtdßqkzfxkzßlßbuhuqgttjpuzzmcyußecfczkpsslhzssbzybgtulsfsszfrbt</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>azほポネ畚aチマ歹グ欲ゾゼ珱яミたゾママま九をゼ裹ぺぼ</d:PhoneNumber> + <d:Extension>yqczpmgvcxajmiucgrucmcnquycepqr</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>ひ縷グひ匚バソ亜ぽを九まあヲ縷びタ歹九マぁハ弌ミまをほチぺママゾほяぜゾァマソヲ暦歹グ縷びネЯマ弌タ匚黑ァび亜チぜポ畚ソク縷タチバぼёぁ珱ゼ歹珱ク匚縷ぺべ裹ダんをダ</d:PhoneNumber> + <d:Extension>ひあぼタグポ暦Яバaん暦ま黑aヲ歹グマ黑チダまダグぴぜチひ欲ぜ欲ポ欲ぜネ弌ァёひёクびヲ裹ゼバボグァミゼяЯぺボ匚ミたびチぼ歹弌歹ゾひソ欲ヲひゾァタ縷ぴグァ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>xisvqplbibxpvmhojc</d:PhoneNumber> + <d:Extension>cemoackiupiiasusm</d:Extension> + </d:element> + </d:MobilePhoneBag> + </d:element> + <d:element> + <d:EmailBag m:type="Collection(Edm.String)"> + <d:element>kxiqzbbrjpsqvpdlnbszackrlrzss</d:element> + <d:element>issppagdcykukfgvmjßdoaidcjhufclßouopsseslcssmopiejuykgtehqßrgbruß</d:element> + <d:element>edbuyltmaulsssuhssajuudevlpdslveßmtoaubhassqca</d:element> + </d:EmailBag> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse</d:element> + <d:element>uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv</d:element> + </d:AlternativeNames> + <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>tquyyaliladoaalcdbkybpstvsssfdaplßmmimctpafk</d:element> + </d:AlternativeNames> + </d:ContactAlias> + <d:HomePhone m:null="true" /> + <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu</d:PhoneNumber> + <d:Extension m:null="true" /> + </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:Extension>ぽせソァボ亜ヲボチソ九暦マまマёびゼ亜そ裹まaミ畚aをぁタそ珱</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx</d:PhoneNumber> + <d:Extension>九そァё欲クソゼぽяぺ</d:Extension> + </d:element> + </d:MobilePhoneBag> + </d:element> + <d:element> + <d:EmailBag m:type="Collection(Edm.String)"> + <d:element>fyiuzdhbppzhilnlqp</d:element> + <d:element>jißpbuusvxokunpjtulsujujiftkstuzrlssxopuidmxvxssgßßosslqznasspmzksßiscu</d:element> + <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>hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu</d:element> + <d:element>ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm</d:element> + </d:EmailBag> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>uekkpqeravjss</d:element> + <d:element>mavokhmecfmctirirkqpntndru</d:element> + <d:element>yumkdbmozzspabuehfngssllurtjmkcibjdiytjviyqkxzmlhudurzuuqep</d:element> + <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>rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi</d:element> + <d:element>縷ほ匚ダ弌縷せЯяぽゼヲンそaタぺチそをバタハひポダ歹ネ裹ポひ縷ゾマたァマ裹そゾせソそゾせポせ暦ゼ</d:element> + <d:element>oqygrqyceoohomkfßpvgkqcujiiakangcquyvvsiaykßgthnbvxv</d:element> + </d:AlternativeNames> + <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"> + <d:AlternativeNames m:type="Collection(Edm.String)" /> + </d:ContactAlias> + <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrzßvlguyc</d:PhoneNumber> + <d:Extension>utuaxkohdsb</d:Extension> + </d:HomePhone> + <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>uruglund</d:PhoneNumber> + <d:Extension m:null="true" /> + </d:WorkPhone> + <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"> + <d:element> + <d:PhoneNumber>ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk</d:PhoneNumber> + <d:Extension>gqvuusqrrriljkospoxbdod</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber m:null="true" /> + <d:Extension>びぜソネを九タяママボё亜ソネミたポ珱暦歹珱べァ黑zぺゼぞ亜ソダ弌あダバポタひ九ボミaソぼびタマまン黑ёクぁ匚ん裹そぁクタぞ縷</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums</d:PhoneNumber> + <d:Extension>zxqxnmuxdlizjdjkuckovjbhkqomjcxnnzßruvoßaypbcaiqjipssujimrdhsshqkarmhmftsgokossxßokmmofryv</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>ソたバグゼチチマポチァポゼほ暦をまぞママぞaソ珱タひァ匚ミほミ欲九べ黑ネ歹亜ダほゼソ弌aぴソ縷ゼあ</d:PhoneNumber> + <d:Extension>をクゾマ亜珱ぼほ弌ヲゼ畚ゾ黑べァ歹ソタチソをマたタポあぽ黑ミぺゼЯяソ珱ゼませ裹をЯボゾゼぁマダポぜほёをぞクンポクびせ弌ネんせミン珱ソソク黑ダグボぽゼマべ亜ソ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>ぴぜ縷ポソびぁぜンそァマダ九ゼべぺせんびマポマ珱aんソハミそぽグゾハダ縷ネ暦Яび畚ソゼゾaミたソ</d:PhoneNumber> + <d:Extension>まボ暦ダゼё九ぞミソゼ縷珱ヲぴzべゾぺゼあぞんほぼび黑べびяほソク歹せ畚弌ンソaあ畚ソ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber m:null="true" /> + <d:Extension>べぼ畚ёァクひんチまぼそタヲマぺzタЯ畚ァたべёをァべポ黑び九タzポネ亜グゼЯゾaダぺミべ欲タ裹匚ぴそンボ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj</d:PhoneNumber> + <d:Extension>匚びチゼ珱ゾ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>gdxratßzquecqkßkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms</d:PhoneNumber> + <d:Extension>fgbypkdxßiycssbbcnapiulvsnaae</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp</d:PhoneNumber> + <d:Extension>ゾネマ欲珱歹バタそミんをひ弌クゾひソヲぞマゼぴべグzzぺ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>fybufznydlniikqhckburnitkjxxhprccnuvofukgbhxnidkdunxcvasvjqvirlptfulptcy</d:PhoneNumber> + <d:Extension>ひびぴグたソバチё暦ЯゼチせЯミポヲクボポ弌ぞほぽ弌暦ゾチマまタёタハマぺん九ポぜネバネァソaチ弌タ</d:Extension> + </d:element> + </d:MobilePhoneBag> + </d:element> + <d:element> + <d:EmailBag m:type="Collection(Edm.String)"> + <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>せマひゾ縷ポあタポぴヲゼぁ珱欲匚ネ暦ま亜ぺソ亜ソポグ裹歹ポネバ</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:AlternativeNames> + <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"> + <d:AlternativeNames m:type="Collection(Edm.String)" /> + </d:ContactAlias> + <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>pkudpiquypr</d:PhoneNumber> + <d:Extension>fvßvvzgßßhqdaxßymdnqfezcedssss</d:Extension> + </d:HomePhone> + <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber>マグソ暦ぴぼソぴ縷ネ歹ハァ縷ミぞんソ匚Я</d:PhoneNumber> + <d:Extension>タぺポぁをゾ亜ほんボまゾぜソググ欲珱яぽぺマァ弌べダチゼぼマa欲ボマぽネハゼ裹グぺバまミバほя畚あゼぴゼ畚ゾタ珱畚畚珱亜zァンバマソ珱ゼびゼ弌ゼヲボ</d:Extension> + </d:WorkPhone> + <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /> + </d:element> + <d:element> + <d:EmailBag m:type="Collection(Edm.String)"> + <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>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>ぽひバゼび黑んびべ九ёぺボチ珱ボバひンヲ黑珱をゼバひせあ匚ヲソタま裹ポボ欲歹チマぽタチ亜ゼゾぺタク九あ欲マ縷マゼ珱ぺ欲я欲ほ</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>yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv</d:element> + <d:element>jukerqchooqmlqug</d:element> + <d:element>sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz</d:element> + </d:AlternativeNames> + </d:ContactAlias> + <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <d:PhoneNumber></d:PhoneNumber> + <d:Extension>hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim</d:Extension> + </d:HomePhone> + <d:WorkPhone m:null="true" /> + <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"> + <d:element> + <d:PhoneNumber>あゾミ九ゾヲぞほチびタz縷縷ほミぴソをa黑クぜバんミたポぜゼ</d:PhoneNumber> + <d:Extension>珱ぴチソぽ畚ゼミ弌ゾ九べぺポ珱ソグんあングミゼぜソ弌暦ソぞびソチЯぼёёひ亜べソタべチハ畚ぜゾゾ暦ポёゼ裹zぼぞ暦ソЯソぁzハボ</d:Extension> + </d:element> + </d:MobilePhoneBag> + </d:element> +</d:BackupContactInfo> diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml index 222567feb..b2841cdbb 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml @@ -19,4 +19,6 @@ under the License. --> -<d:CustomerId xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:type="Edm.Int32">-10</d:CustomerId> +<d:CustomerId xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" + xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" + m:type="Edm.Int32">-10</d:CustomerId> diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json index 2c9eb34d4..d8fe2178e 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json @@ -1 +1,44 @@ -{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag":["rdstukrvlltte\u00dfzi","psgdkmxamznjulzbsohqjytbxhnojbufe","\u3092\uff9d\u307a\u3072\u307c\u30bc\u305b\u66a6\u88f9\u044f\u88f9\u307a\u3042\u4e9c\u305e\uff5a\u30a1\u30d0\u755a\u30de\uff88\u305e\u30bc\u3042\uff88\u5f0c\u30c1\u30a1\u6b79\u307e\u30bc\u7e37\u30c1\u30cf\u88f9\u4e9c\u9ed1\u307b\u30bc\u0451\u6b79"],"AlternativeNames":["\u30b0\u3041\u30de\u305b\u307a\uff88\u30bd\u3041\u307c\u30bd\u3072\u30d0\u305f\u3074\u30bd\u6b79\u4e5d\uff88\u30dc\u30dc\u044f\u30dd\u30bd\u755a\u30af\u044f\u305b\u3079\u6b79\u73f1\u042f\u6b32\u30bf\u30cf\u30d0\u30df\u88f9\u307c\u30dc\u3092\uff66\u6b79\u3093\u3072\u4e5d\u3072\u531a\u3041\uff41","qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta","btsnhqrjqryqzgxducl","qbtlssjhunufmzdv","\u30dc\u3093\u042f\u305c\u30c1\u3079\u30bc\u30dc\u30dc\u307b\uff41\u531a\u30df\u307c\u4e5d\u3041\u3072\u30c1\u73f1\u9ed1\u30df\u3093\u3041\u30bf\u3073\u66a6\u30af\u30bd\u30bd\u30dc\u30be\u3093\u3093\u3042\u30bc\u305e\u3072\u30bf\u30dc\u30bf\u305c\u3093\u5f0c\u3072\u3079\u531a","vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae","\u4e5d\u30bd\u30df\u305b\u30dc\u305c\u30be\u30dc\u0451\uff41\u3092\u305c\u042f\u307e\u30be\u30bf\u305c\u30bf\u3072\u7e37\u30c0\u3093\uff41\u30d0\u305f\u30bc\u30bd","\u307d\u30de\u30bf\u3041\u3041\u9ed1\u30bd\u30bc\u30df\u30bc\u531a\uff5a\u30bd\u30c0\u30de\u3041\u30a1\u30be\u307d\u30df\uff41\u30bf\u30be\u5f0c\u30df\u30bc\u30bf\u305d\uff5a\u307a\u30dd\u305b\u88f9\u30d0\u30dd\u30cf\u30cf\uff66\u307a\u30c1\u3042\u30de\u531a\u30df","hssii\u00dfuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbd\u00dfjnelxqttkhdalabibuqhiubt\u00dfsptrmzelud","gbjssllxzzxkm\u00dfppyyrhgmoe\u00dfizlcmsuqqnvj\u00dfudszevtfunflqzqcuubukyp\u00dfqjcix"],"ContactAlias":{"AlternativeNames":["\u30bc\u30dd\u30bd\u30bd\u30a1\u3093\u30de\uff41\u30b0\u3074\u4e5d\u7e37\u4e9c\u305e\u30bc\u30bd\u30b0\u30d0\u307c\u30c0\u307d\u30de\u30de\u307d\u30dd\u30c1\u30dc\u30bd\u307c\u305c\u30be\u3093\u30df\u3074\u307b\u30c0\u30df\u30df\u755a\u73f1\u4e5d\uff5a\u3079\u5f0c\u755a\u30bf\u30bd\uff5a\u30bc\u30bd\u3041\u3073\u88f9\u30a1\u30bd\u30de\uff66\u3072\u531a\u4e9c\u30dd\u3079\u30dd\u307d\u30de\u30bc\u305f\u30c1\u88f9\u6b79\u30df\u30dd","flzjuisevegjjtmpnssobmdssikhzepsjklnoceuqr\u00dfuychauxhdutqcdenvssubqkoqyzxpfmvflbhjs","esgmrxddisdvykgttpmizcethjuazqxemuossopssaqpmqd\u00dfkayrrocgsxqpo","\u30af\u30bd\u73f1\u3079\u3092\u30de\u3093\u30b0\u30cf\u3072\u30dc\u30bd\u30bd\u3093\u30df\u30bd\u30bd\u30bc\uff9d\u305e\u305f\u307c\uff5a\u30df\u6b79\u3074","ljrggbaseqsrkelksvhouoscmoilogibae","\u305d\u305c\u305c\u30de\u30de\u30bc\u30df\u307c\u30bc\u30dc\u3079\u30bd\u307b\u3042\u3093\u305b\u3072\u3073\u30bc\u30df\u30bd\u5f0c\u307b\u305d\u30bf\u30dc\u30de\u30c1\u30bf\u30de\u30bd\uff88\u5f0c\u30c1\u30dd\u531a\u307e\u30bd\u30be\u30de\u042f\u042f\u305f\u30be\u88f9\u3042\u755a\u3093\u5f0c\u305f\u73f1\u755a\u30de\u042f\u30bd\u30a1\u73f1\uff88\u3073\u0451\u4e5d\u305f\u30df\u30df\u3074\u307a\u30dd\u30de\u30bc\u30c0\u5f0c\u30df\u30de\u30de\u30de\u30bd\u30dc\u4e9c\u307a\u30bd\u531a\u30b0\u5f0c\u30b0\u6b79\u30cf\u307e\u531a\u305d\u3093\u9ed1\u3093","ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl","\u305f\u0451\u30bf\u042f\u044f\u307e\u3072\u307a\u30a1\u66a6\u30bd\u30de\u30dd\u30cf\u30af\u30bf\u305b\u305f\u3072\u30a1\u66a6\uff66\u4e5d\u66a6\u305e\u305c\u30c1\u531a\u6b32\u30bc\u307b\u4e5d\u307a\u755a\u3073\u305e\u30dd\u30dc\u30af\u3074\u3092\u30c1\u30c1\u305d\u30dc\u30bd\u30de\u30dd\u3093\u307d\u30df\u30a1\u5f0c\u30a1\u305e\u3074\u307e\u30df\u7e37\u9ed1\u30df\u30bc\u30bc\uff5a\u30c1\u30df\u30bd\u66a6\u30bc\u307b\u755a\u30bd\u531a\uff88\u0451\u307b\u30bc\u30dc\u3074\u30dd\u30bc\u7e37\u30bd\u30c1\u30dd\u88f9\uff66\u7e37\u4e5d\uff9d\u6b79\uff41\u4e5d\u30bd\u30bd"]},"HomePhone":{"PhoneNumber":"\u755a\u307c\u305b\u30bc\u307d\u30c1\u6b32\u3092\u7e37\u5f0c\u30dd\u30bf\u307a\u30be\u6b32\uff41\u6b79\u307e\u30de\u4e9c\u30c1\u3041\u30bc\u30bc\uff41\u30de\u30a1\u30be\u305e\u3042\u5f0c\u305d\u3092\u30dd\u30c0\u30dc\u30b0\u3073\u30bc\u30a1\u305f\u30c1\u73f1\u3079\u3074\u30bc\u30bf\uff5a\u30dc\uff88\u30a1\u30a1\u6b79\u305e\u30bc\u6b32\u6b32\u30de\u30bd\u30c1\u307a\u3093\u3073\u66a6\uff9d\u30bf\u307a\u30c0\uff5a\u3074\u30c0\u30dd\u7e37\u30a1\u30dc\u042f\u3079\u307a\u3079\u30bf\u3073\u30b0\u73f1\u305f\u30df\u30bd\u307d\u3072\u307c\u30df\u66a6\u30de\u30df\u6b79\u305d\u6b32\u30bc\u0451\u3079\u30dd","Extension":"jqjklhnnkyhujailcedbguyectpuamgbghreatqvobbtj"},"WorkPhone":{"PhoneNumber":"\u305d\u30de\u5f0c\u3042\u30cf\u30df\u30bc\u307c\u30de\u531a\u30bd\u30d0\uff5a\u30c1\u3074\u30bd\u3041\u3093\u0451\u30bf\u30be\u30bc\u30bd\u305b\u3074\u30dc\u3072\u30cf\uff88\u30bc\u307d\u3079\u30a1\u305f\u307a\u30be\u30c1\u30a1\u305d","Extension":"erpdbdvgezuztcsy\u00dfpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkade\u00dfustx\u00dff"},"MobilePhoneBag":[{"PhoneNumber":"essfchpbmodumdlbssaoygvcecneg\u00dfumuvszyo","Extension":"ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj"},{"PhoneNumber":"bbyr","Extension":"\u30b0\u3074\u30bc\u307b\u88f9\u044f\u307b\u30de\u30bf\uff88\u755a\u3092\u30bd\u4e5d\u30af\u30bc\u755a\u30bc\u30a1\u7e37\u3072\u30b0\uff66\u307d\u044f\u30c0\u6b79"},{"PhoneNumber":"litlxcyvpspjqankvmvtmvoabobguscosktgzul","Extension":"jump\u00df\u00dfhqzmjxq\u00dfufuaprymlrb"},{"PhoneNumber":"bfi","Extension":"mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl"},{"PhoneNumber":"jmvrssnupsqltlmuegpybunosssspluvvgqenfgvrjhxqqjjqublkeekssyjisdssrxyvooj","Extension":"\uff41\u30be\u66a6\uff66\uff41\u30be\u3092\u30c1\u0451\u30bc\u3092\u307d\u30a1\u4e9c\u307d\u3072\u305e\u30dd\u88f9\u307c\u305c\u30bc\u30bd\u30df\uff88\u30df\u66a6\u307d\u307d\u3079\u3079\u30df\u531a\uff41\u305e\u30c1\u30dc\uff88\uff66\u9ed1\u66a6\u305f\u307b\u30bf\u30af\u30c1\u30c0\u0451\u73f1\uff88\u3092\u3092\u30c1\u30bd"},{"PhoneNumber":"bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu","Extension":""},{"PhoneNumber":"moc\u00dfmhbuavyssxuosdkmcdqbkyadgusvssppytbtuurg\u00dfqacmbhfghvugzssvi","Extension":"\u3092\uff9d\u9ed1\u30b0\u307c\u9ed1\u30bc\u30bf\u30bf\u30dd\u4e5d\u30c1\uff5a\u30dd\u30c1\u30bc\u30dd\u30bf\u3041\uff41\u30bd\u30a1\u30bc\u305f\u30bc\u307c\uff88\u531a\u30bc\u30dd\u307e\u30dd\u66a6\uff5a\u30de\u30dc\u305c\u6b79\u307c"},{"PhoneNumber":null,"Extension":"\u30d0\u30bc\u307c\u30af\u30b0"},{"PhoneNumber":"\uff5a\u30c1\u4e9c\uff88\uff9d\uff41\u30d0\u305d\u73f1\u30b0\u305b\u4e9c\uff9d\uff88\uff66\u3093\u6b79\u307e\u4e9c\uff41\u30dd\u30bf\u30df\u305c\u5f0c\u73f1\u30df\u30bc\u042f\u307b\u3093\u30dc\u88f9\u044f\u4e5d\u3041\u30a1\u73f1\u307c\u30af\u30bc\u30dd\uff88\u30a1\uff88\u73f1\u30bc\u307e\u30bc\u3042\u30cf\u30de\u307e\uff88\u307c\u30bc\u6b79\u30dd\u3074\u305f\u3079\u3079\u305d\u30dc\u3041\u30bd\u73f1\uff66\u307a\u9ed1\uff9d\uff88\u0451\u30bc\u30c0\u042f\u30bf\u30bc\u305d\uff5a\u30bd\u30bd\uff9d\uff5a\u30dc\u30dc\u30a1\u9ed1\u531a\u3093\u3079\u30dd\u30dd","Extension":"gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg"}]} \ No newline at end of file +{ + "odata.metadata": "http://192.168.0.160:8080/DefaultService.svc/$metadata#Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails", + "EmailBag": ["rdstukrvlltte\u00dfzi", "psgdkmxamznjulzbsohqjytbxhnojbufe", "\u3092\uff9d\u307a\u3072\u307c\u30bc\u305b\u66a6\u88f9\u044f\u88f9\u307a\u3042\u4e9c\u305e\uff5a\u30a1\u30d0\u755a\u30de\uff88\u305e\u30bc\u3042\uff88\u5f0c\u30c1\u30a1\u6b79\u307e\u30bc\u7e37\u30c1\u30cf\u88f9\u4e9c\u9ed1\u307b\u30bc\u0451\u6b79"], + "AlternativeNames": ["\u30b0\u3041\u30de\u305b\u307a\uff88\u30bd\u3041\u307c\u30bd\u3072\u30d0\u305f\u3074\u30bd\u6b79\u4e5d\uff88\u30dc\u30dc\u044f\u30dd\u30bd\u755a\u30af\u044f\u305b\u3079\u6b79\u73f1\u042f\u6b32\u30bf\u30cf\u30d0\u30df\u88f9\u307c\u30dc\u3092\uff66\u6b79\u3093\u3072\u4e5d\u3072\u531a\u3041\uff41", "qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta", "btsnhqrjqryqzgxducl", "qbtlssjhunufmzdv", "\u30dc\u3093\u042f\u305c\u30c1\u3079\u30bc\u30dc\u30dc\u307b\uff41\u531a\u30df\u307c\u4e5d\u3041\u3072\u30c1\u73f1\u9ed1\u30df\u3093\u3041\u30bf\u3073\u66a6\u30af\u30bd\u30bd\u30dc\u30be\u3093\u3093\u3042\u30bc\u305e\u3072\u30bf\u30dc\u30bf\u305c\u3093\u5f0c\u3072\u3079\u531a", "vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae", "\u4e5d\u30bd\u30df\u305b\u30dc\u305c\u30be\u30dc\u0451\uff41\u3092\u305c\u042f\u307e\u30be\u30bf\u305c\u30bf\u3072\u7e37\u30c0\u3093\uff41\u30d0\u305f\u30bc\u30bd", "\u307d\u30de\u30bf\u3041\u3041\u9ed1\u30bd\u30bc\u30df\u30bc\u531a\uff5a\u30bd\u30c0\u30de\u3041\u30a1\u30be\u307d\u30df\uff41\u30bf\u30be\u5f0c\u30df\u30bc\u30bf\u305d\uff5a\u307a\u30dd\u305b\u88f9\u30d0\u30dd\u30cf\u30cf\uff66\u307a\u30c1\u3042\u30de\u531a\u30df", "hssii\u00dfuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbd\u00dfjnelxqttkhdalabibuqhiubt\u00dfsptrmzelud", "gbjssllxzzxkm\u00dfppyyrhgmoe\u00dfizlcmsuqqnvj\u00dfudszevtfunflqzqcuubukyp\u00dfqjcix"], + "ContactAlias": { + "AlternativeNames": ["\u30bc\u30dd\u30bd\u30bd\u30a1\u3093\u30de\uff41\u30b0\u3074\u4e5d\u7e37\u4e9c\u305e\u30bc\u30bd\u30b0\u30d0\u307c\u30c0\u307d\u30de\u30de\u307d\u30dd\u30c1\u30dc\u30bd\u307c\u305c\u30be\u3093\u30df\u3074\u307b\u30c0\u30df\u30df\u755a\u73f1\u4e5d\uff5a\u3079\u5f0c\u755a\u30bf\u30bd\uff5a\u30bc\u30bd\u3041\u3073\u88f9\u30a1\u30bd\u30de\uff66\u3072\u531a\u4e9c\u30dd\u3079\u30dd\u307d\u30de\u30bc\u305f\u30c1\u88f9\u6b79\u30df\u30dd", "flzjuisevegjjtmpnssobmdssikhzepsjklnoceuqr\u00dfuychauxhdutqcdenvssubqkoqyzxpfmvflbhjs", "esgmrxddisdvykgttpmizcethjuazqxemuossopssaqpmqd\u00dfkayrrocgsxqpo", "\u30af\u30bd\u73f1\u3079\u3092\u30de\u3093\u30b0\u30cf\u3072\u30dc\u30bd\u30bd\u3093\u30df\u30bd\u30bd\u30bc\uff9d\u305e\u305f\u307c\uff5a\u30df\u6b79\u3074", "ljrggbaseqsrkelksvhouoscmoilogibae", "\u305d\u305c\u305c\u30de\u30de\u30bc\u30df\u307c\u30bc\u30dc\u3079\u30bd\u307b\u3042\u3093\u305b\u3072\u3073\u30bc\u30df\u30bd\u5f0c\u307b\u305d\u30bf\u30dc\u30de\u30c1\u30bf\u30de\u30bd\uff88\u5f0c\u30c1\u30dd\u531a\u307e\u30bd\u30be\u30de\u042f\u042f\u305f\u30be\u88f9\u3042\u755a\u3093\u5f0c\u305f\u73f1\u755a\u30de\u042f\u30bd\u30a1\u73f1\uff88\u3073\u0451\u4e5d\u305f\u30df\u30df\u3074\u307a\u30dd\u30de\u30bc\u30c0\u5f0c\u30df\u30de\u30de\u30de\u30bd\u30dc\u4e9c\u307a\u30bd\u531a\u30b0\u5f0c\u30b0\u6b79\u30cf\u307e\u531a\u305d\u3093\u9ed1\u3093", "ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl", "\u305f\u0451\u30bf\u042f\u044f\u307e\u3072\u307a\u30a1\u66a6\u30bd\u30de\u30dd\u30cf\u30af\u30bf\u305b\u305f\u3072\u30a1\u66a6\uff66\u4e5d\u66a6\u305e\u305c\u30c1\u531a\u6b32\u30bc\u307b\u4e5d\u307a\u755a\u3073\u305e\u30dd\u30dc\u30af\u3074\u3092\u30c1\u30c1\u305d\u30dc\u30bd\u30de\u30dd\u3093\u307d\u30df\u30a1\u5f0c\u30a1\u305e\u3074\u307e\u30df\u7e37\u9ed1\u30df\u30bc\u30bc\uff5a\u30c1\u30df\u30bd\u66a6\u30bc\u307b\u755a\u30bd\u531a\uff88\u0451\u307b\u30bc\u30dc\u3074\u30dd\u30bc\u7e37\u30bd\u30c1\u30dd\u88f9\uff66\u7e37\u4e5d\uff9d\u6b79\uff41\u4e5d\u30bd\u30bd"] + }, + "HomePhone": { + "PhoneNumber": "\u755a\u307c\u305b\u30bc\u307d\u30c1\u6b32\u3092\u7e37\u5f0c\u30dd\u30bf\u307a\u30be\u6b32\uff41\u6b79\u307e\u30de\u4e9c\u30c1\u3041\u30bc\u30bc\uff41\u30de\u30a1\u30be\u305e\u3042\u5f0c\u305d\u3092\u30dd\u30c0\u30dc\u30b0\u3073\u30bc\u30a1\u305f\u30c1\u73f1\u3079\u3074\u30bc\u30bf\uff5a\u30dc\uff88\u30a1\u30a1\u6b79\u305e\u30bc\u6b32\u6b32\u30de\u30bd\u30c1\u307a\u3093\u3073\u66a6\uff9d\u30bf\u307a\u30c0\uff5a\u3074\u30c0\u30dd\u7e37\u30a1\u30dc\u042f\u3079\u307a\u3079\u30bf\u3073\u30b0\u73f1\u305f\u30df\u30bd\u307d\u3072\u307c\u30df\u66a6\u30de\u30df\u6b79\u305d\u6b32\u30bc\u0451\u3079\u30dd", + "Extension": "jqjklhnnkyhujailcedbguyectpuamgbghreatqvobbtj" + }, + "WorkPhone": { + "PhoneNumber": "\u305d\u30de\u5f0c\u3042\u30cf\u30df\u30bc\u307c\u30de\u531a\u30bd\u30d0\uff5a\u30c1\u3074\u30bd\u3041\u3093\u0451\u30bf\u30be\u30bc\u30bd\u305b\u3074\u30dc\u3072\u30cf\uff88\u30bc\u307d\u3079\u30a1\u305f\u307a\u30be\u30c1\u30a1\u305d", + "Extension": "erpdbdvgezuztcsy\u00dfpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkade\u00dfustx\u00dff" + }, + "MobilePhoneBag": [{ + "PhoneNumber": "essfchpbmodumdlbssaoygvcecneg\u00dfumuvszyo", + "Extension": "ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj" + }, { + "PhoneNumber": "bbyr", + "Extension": "\u30b0\u3074\u30bc\u307b\u88f9\u044f\u307b\u30de\u30bf\uff88\u755a\u3092\u30bd\u4e5d\u30af\u30bc\u755a\u30bc\u30a1\u7e37\u3072\u30b0\uff66\u307d\u044f\u30c0\u6b79" + }, { + "PhoneNumber": "litlxcyvpspjqankvmvtmvoabobguscosktgzul", + "Extension": "jump\u00df\u00dfhqzmjxq\u00dfufuaprymlrb" + }, { + "PhoneNumber": "bfi", + "Extension": "mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl" + }, { + "PhoneNumber": "jmvrssnupsqltlmuegpybunosssspluvvgqenfgvrjhxqqjjqublkeekssyjisdssrxyvooj", + "Extension": "\uff41\u30be\u66a6\uff66\uff41\u30be\u3092\u30c1\u0451\u30bc\u3092\u307d\u30a1\u4e9c\u307d\u3072\u305e\u30dd\u88f9\u307c\u305c\u30bc\u30bd\u30df\uff88\u30df\u66a6\u307d\u307d\u3079\u3079\u30df\u531a\uff41\u305e\u30c1\u30dc\uff88\uff66\u9ed1\u66a6\u305f\u307b\u30bf\u30af\u30c1\u30c0\u0451\u73f1\uff88\u3092\u3092\u30c1\u30bd" + }, { + "PhoneNumber": "bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu", + "Extension": "" + }, { + "PhoneNumber": "moc\u00dfmhbuavyssxuosdkmcdqbkyadgusvssppytbtuurg\u00dfqacmbhfghvugzssvi", + "Extension": "\u3092\uff9d\u9ed1\u30b0\u307c\u9ed1\u30bc\u30bf\u30bf\u30dd\u4e5d\u30c1\uff5a\u30dd\u30c1\u30bc\u30dd\u30bf\u3041\uff41\u30bd\u30a1\u30bc\u305f\u30bc\u307c\uff88\u531a\u30bc\u30dd\u307e\u30dd\u66a6\uff5a\u30de\u30dc\u305c\u6b79\u307c" + }, { + "PhoneNumber": null, + "Extension": "\u30d0\u30bc\u307c\u30af\u30b0" + }, { + "PhoneNumber": "\uff5a\u30c1\u4e9c\uff88\uff9d\uff41\u30d0\u305d\u73f1\u30b0\u305b\u4e9c\uff9d\uff88\uff66\u3093\u6b79\u307e\u4e9c\uff41\u30dd\u30bf\u30df\u305c\u5f0c\u73f1\u30df\u30bc\u042f\u307b\u3093\u30dc\u88f9\u044f\u4e5d\u3041\u30a1\u73f1\u307c\u30af\u30bc\u30dd\uff88\u30a1\uff88\u73f1\u30bc\u307e\u30bc\u3042\u30cf\u30de\u307e\uff88\u307c\u30bc\u6b79\u30dd\u3074\u305f\u3079\u3079\u305d\u30dc\u3041\u30bd\u73f1\uff66\u307a\u9ed1\uff9d\uff88\u0451\u30bc\u30c0\u042f\u30bf\u30bc\u305d\uff5a\u30bd\u30bd\uff9d\uff5a\u30dc\u30dc\u30a1\u9ed1\u531a\u3093\u3079\u30dd\u30dd", + "Extension": "gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg" + }] +} \ No newline at end of file diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml index bf1e36079..7c0c90363 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml @@ -19,4 +19,84 @@ under the License. --> -<d:PrimaryContactInfo 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" m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails"><d:EmailBag m:type="Collection(Edm.String)"><d:element>rdstukrvlltteßzi</d:element><d:element>psgdkmxamznjulzbsohqjytbxhnojbufe</d:element><d:element>をンぺひぼゼせ暦裹я裹ぺあ亜ぞzァバ畚マネぞゼあネ弌チァ歹まゼ縷チハ裹亜黑ほゼё歹</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>グぁマせぺネソぁぼソひバたぴソ歹九ネボボяポソ畚クяせべ歹珱Я欲タハバミ裹ぼボをヲ歹んひ九ひ匚ぁa</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>gbjssllxzzxkmßppyyrhgmoeßizlcmsuqqnvjßudszevtfunflqzqcuubukypßqjcix</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>ゼポソソァんマaグぴ九縷亜ぞゼソグバぼダぽママぽポチボソぼぜゾんミぴほダミミ畚珱九zべ弌畚タソzゼソぁび裹ァソマヲひ匚亜ポべポぽマゼたチ裹歹ミポ</d:element><d:element>flzjuisevegjjtmpnssobmdssikhzepsjklnoceuqrßuychauxhdutqcdenvssubqkoqyzxpfmvflbhjs</d:element><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:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><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:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>essfchpbmodumdlbssaoygvcecnegßumuvszyo</d:PhoneNumber><d:Extension>ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj</d:Extension></d:element><d:element><d:PhoneNumber>bbyr</d:PhoneNumber><d:Extension>グぴゼほ裹яほマタネ畚をソ九クゼ畚ゼァ縷ひグヲぽяダ歹</d:Extension></d:element><d:element><d:PhoneNumber>litlxcyvpspjqankvmvtmvoabobguscosktgzul</d:PhoneNumber><d:Extension>jumpßßhqzmjxqßufuaprymlrb</d:Extension></d:element><d:element><d:PhoneNumber>bfi</d:PhoneNumber><d:Extension>mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl</d:Extension></d:element><d:element><d:PhoneNumber>jmvrssnupsqltlmuegpybunosssspluvvgqenfgvrjhxqqjjqublkeekssyjisdssrxyvooj</d:PhoneNumber><d:Extension>aゾ暦ヲaゾをチёゼをぽァ亜ぽひぞポ裹ぼぜゼソミネミ暦ぽぽべべミ匚aぞチボネヲ黑暦たほタクチダё珱ネををチソ</d:Extension></d:element><d:element><d:PhoneNumber>bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu</d:PhoneNumber><d:Extension></d:Extension></d:element><d:element><d:PhoneNumber>mocßmhbuavyssxuosdkmcdqbkyadgusvssppytbtuurgßqacmbhfghvugzssvi</d:PhoneNumber><d:Extension>をン黑グぼ黑ゼタタポ九チzポチゼポタぁaソァゼたゼぼネ匚ゼポまポ暦zマボぜ歹ぼ</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>バゼぼクグ</d:Extension></d:element><d:element><d:PhoneNumber>zチ亜ネンaバそ珱グせ亜ンネヲん歹ま亜aポタミぜ弌珱ミゼЯほんボ裹я九ぁァ珱ぼクゼポネァネ珱ゼまゼあハマまネぼゼ歹ポぴたべべそボぁソ珱ヲぺ黑ンネёゼダЯタゼそzソソンzボボァ黑匚んべポポ</d:PhoneNumber><d:Extension>gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg</d:Extension></d:element></d:MobilePhoneBag></d:PrimaryContactInfo> +<d:PrimaryContactInfo 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" + m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails"> + <d:EmailBag m:type="Collection(Edm.String)"> + <d:element>rdstukrvlltteßzi</d:element> + <d:element>psgdkmxamznjulzbsohqjytbxhnojbufe</d:element> + <d:element>をンぺひぼゼせ暦裹я裹ぺあ亜ぞzァバ畚マネぞゼあネ弌チァ歹まゼ縷チハ裹亜黑ほゼё歹</d:element> + </d:EmailBag> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>グぁマせぺネソぁぼソひバたぴソ歹九ネボボяポソ畚クяせべ歹珱Я欲タハバミ裹ぼボをヲ歹んひ九ひ匚ぁa</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>gbjssllxzzxkmßppyyrhgmoeßizlcmsuqqnvjßudszevtfunflqzqcuubukypßqjcix</d:element> + </d:AlternativeNames> + <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"> + <d:AlternativeNames m:type="Collection(Edm.String)"> + <d:element>ゼポソソァんマaグぴ九縷亜ぞゼソグバぼダぽママぽポチボソぼぜゾんミぴほダミミ畚珱九zべ弌畚タソzゼソぁび裹ァソマヲひ匚亜ポべポぽマゼたチ裹歹ミポ</d:element> + <d:element>flzjuisevegjjtmpnssobmdssikhzepsjklnoceuqrßuychauxhdutqcdenvssubqkoqyzxpfmvflbhjs</d:element> + <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:AlternativeNames> + </d:ContactAlias> + <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"> + <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:WorkPhone> + <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"> + <d:element> + <d:PhoneNumber>essfchpbmodumdlbssaoygvcecnegßumuvszyo</d:PhoneNumber> + <d:Extension>ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>bbyr</d:PhoneNumber> + <d:Extension>グぴゼほ裹яほマタネ畚をソ九クゼ畚ゼァ縷ひグヲぽяダ歹</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>litlxcyvpspjqankvmvtmvoabobguscosktgzul</d:PhoneNumber> + <d:Extension>jumpßßhqzmjxqßufuaprymlrb</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>bfi</d:PhoneNumber> + <d:Extension>mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>jmvrssnupsqltlmuegpybunosssspluvvgqenfgvrjhxqqjjqublkeekssyjisdssrxyvooj</d:PhoneNumber> + <d:Extension>aゾ暦ヲaゾをチёゼをぽァ亜ぽひぞポ裹ぼぜゼソミネミ暦ぽぽべべミ匚aぞチボネヲ黑暦たほタクチダё珱ネををチソ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu</d:PhoneNumber> + <d:Extension></d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>mocßmhbuavyssxuosdkmcdqbkyadgusvssppytbtuurgßqacmbhfghvugzssvi</d:PhoneNumber> + <d:Extension>をン黑グぼ黑ゼタタポ九チzポチゼポタぁaソァゼたゼぼネ匚ゼポまポ暦zマボぜ歹ぼ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber m:null="true" /> + <d:Extension>バゼぼクグ</d:Extension> + </d:element> + <d:element> + <d:PhoneNumber>zチ亜ネンaバそ珱グせ亜ンネヲん歹ま亜aポタミぜ弌珱ミゼЯほんボ裹я九ぁァ珱ぼクゼポネァネ珱ゼまゼあハマまネぼゼ歹ポぴたべべそボぁソ珱ヲぺ黑ンネёゼダЯタゼそzソソンzボボァ黑匚んべポポ</d:PhoneNumber> + <d:Extension>gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg</d:Extension> + </d:element> + </d:MobilePhoneBag> +</d:PrimaryContactInfo> diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/atom_cleanup.xsl b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl similarity index 100% rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/atom_cleanup.xsl rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl 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 2ef78ad9d..9d999ff1b 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> 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 000000000..776d57863 --- /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" + } +} 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 000000000..75ec28dfd --- /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> 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 000000000..eceecbb98 --- /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" +} 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 000000000..068cb532e --- /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> 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 000000000..c8e2cdfc5 --- /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" + }] +} 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 000000000..aa416d2b0 --- /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.0 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> 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 000000000..8748df307 --- /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" +} 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 000000000..5029af511 --- /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> 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 000000000..c8b62d396 --- /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" +} 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 000000000..e7fce1250 --- /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> 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 new file mode 100644 index 000000000..0545d78b5 --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json @@ -0,0 +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" + } +} diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml new file mode 100644 index 000000000..9109f2dde --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml @@ -0,0 +1,49 @@ +<?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#Products/$entity"> + <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)</id> + <category term="#Microsoft.Test.OData.Services.ODataWCFService.Product" scheme="http://docs.oasis-open.org/odata/ns/scheme" /> + <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)" /> + <link rel="http://docs.oasis-open.org/odata/ns/related/Details" type="application/atom+xml;type=feed" title="Details" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details" /> + <title /> + <updated>2014-03-28T11:24:49Z</updated> + <author> + <name /> + </author> + <content type="application/xml"> + <m:properties> + <d:ProductID m:type="Int32">5</d:ProductID> + <d:Name>Cheetos</d:Name> + <d:QuantityPerUnit>100g Bag</d:QuantityPerUnit> + <d:UnitPrice m:type="Single">3.24</d:UnitPrice> + <d:QuantityInStock m:type="Int32">100</d:QuantityInStock> + <d:Discontinued m:type="Boolean">true</d:Discontinued> + <d:UserAccess m:type="#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel">None</d:UserAccess> + <d:SkinColor m:type="#Microsoft.Test.OData.Services.ODataWCFService.Color">Red</d:SkinColor> + <d:CoverColors m:type="#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)"> + <m:element>Green</m:element> + <m:element>Blue</m:element> + <m:element>Blue</m:element> + </d:CoverColors> + </m:properties> + </content> +</entry> 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 000000000..96bf22ad3 --- /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"] +} 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 000000000..0dab08c52 --- /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> diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.json new file mode 100644 index 000000000..b5e26daea --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.json @@ -0,0 +1,5 @@ +{ + "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/SkinColor", + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Color", + "value": "Red" +} diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.xml new file mode 100644 index 000000000..be392fd60 --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.xml @@ -0,0 +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 + + 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)/SkinColor" + m:type="#Microsoft.Test.OData.Services.ODataWCFService.Color" + xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">Red</m:value> \ No newline at end of file diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.json new file mode 100644 index 000000000..5f3f6976e --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.json @@ -0,0 +1,50 @@ +{ + "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#VipCustomer", + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer", + "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer", + "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer", + "PersonID": 1, + "FirstName": "Bob", + "LastName": "Cat", + "MiddleName": "Vat", + "HomeAddress": { + "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Address", + "Street": "1 Microsoft Way", + "City": "London", + "PostalCode": "98052" + }, + "Home@odata.type": "#GeographyPoint", + "Home": { + "type": "Point", + "coordinates": [23.1, 32.1], + "crs": { + "type": "name", + "properties": { + "name": "EPSG:4326" + } + } + }, + "Numbers@odata.type": "#Collection(String)", + "Numbers": ["111-111-1111"], + "Emails@odata.type": "#Collection(String)", + "Emails": ["abc@abc.com"], + "City": "London", + "Birthday@odata.type": "#DateTimeOffset", + "Birthday": "1957-04-03T00:00:00Z", + "TimeBetweenLastTwoOrders@odata.type": "#Duration", + "TimeBetweenLastTwoOrders": "PT0.0000001S", + "Parent@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Parent/$ref", + "Parent@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Parent", + "Orders@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Orders/$ref", + "Orders@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Orders", + "Company@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Company/$ref", + "Company@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Company", + "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress": { + "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress", + "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress" + }, + "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress": { + "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress", + "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress" + } +} 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 new file mode 100644 index 000000000..d233ce942 --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml @@ -0,0 +1,73 @@ +<?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#VipCustomer"> + <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer</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/VipCustomer" /> + <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/VipCustomer/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/VipCustomer/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/VipCustomer/Company" /> + <title /> + <updated>2014-03-28T13:03:32Z</updated> + <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> + <d:FirstName>Bob</d:FirstName> + <d:LastName>Cat</d:LastName> + <d:MiddleName>Vat</d:MiddleName> + <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.Address"> + <d:Street>1 Microsoft Way</d:Street> + <d:City>London</d:City> + <d:PostalCode>98052</d:PostalCode> + </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> 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 new file mode 100644 index 000000000..ed302017b --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl @@ -0,0 +1,48 @@ +<?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. + +--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.w3.org/2005/Atom" + xmlns:atom="http://www.w3.org/2005/Atom" + xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" + version="1.0"> + + <xsl:template match="atom:updated"/> + <xsl:template match="atom:author"/> + <xsl:template match="atom:title"> + <xsl:if test="string-length(.) > 0"> + <title type="{@type}"> + <xsl:apply-templates/> + + + + + + + + + + + + + + + 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 000000000..7646ee873 --- /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)" + } + ] +} 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 000000000..953427014 --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml @@ -0,0 +1,25 @@ + + + + + + diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/complexProperty.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/complexProperty.json deleted file mode 100644 index 53af94c58..000000000 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/complexProperty.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Address": { - "Street": "Obere Str. 57", - "City": "Berlin", - "Region": null, - "PostalCode": "D-12209" - } -} \ No newline at end of file diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfComplexProperties.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json similarity index 71% rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfComplexProperties.json rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json index 24ec160ad..0bf131ee8 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfComplexProperties.json +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json @@ -3,11 +3,12 @@ { "Number": "425-555-1212", "Type": "Home" - }, { - "odata.type": "#Model.CellPhoneNumber", + }, + { + "@odata.type": "#Model.CellPhoneNumber", "Number": "425-555-0178", "Type": "Cell", "Carrier": "Sprint" - } + } ] } \ No newline at end of file diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfPrimitiveProperties.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json similarity index 54% rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfPrimitiveProperties.json rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json index 61b3d2c4e..dc811b4ba 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfPrimitiveProperties.json +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json @@ -1,8 +1,7 @@ { - "odata.context": "http://host/service/$metadata#Customers/$entity", - + "@odata.context": "http://host/service/$metadata#Customers/$entity", "EmailAddresses": [ "Julie@Swansworth.com", "Julie.Swansworth@work.com" ] -} \ No newline at end of file +} diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.complex.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.complex.json new file mode 100644 index 000000000..189613f15 --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.complex.json @@ -0,0 +1,12 @@ +{ + "CompanyID": 0, + "CompanyCategory": "IT", + "Revenue": 100000, + "Name": "MS", + "Address": { + "Street": "1 Microsoft Way", + "City": "Redmond", + "PostalCode": "98052", + "CompanyName": "Microsoft" + } +} \ No newline at end of file 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 new file mode 100644 index 000000000..bcd1dbaf4 --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.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 diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.minimal.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.minimal.json new file mode 100644 index 000000000..de0a50b0e --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.minimal.json @@ -0,0 +1,15 @@ +{ + "@odata.context": "http://host/service/$metadata#Customers/$entity", + "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" + } +} \ No newline at end of file diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.primitive.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.primitive.json new file mode 100644 index 000000000..db12081fe --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.primitive.json @@ -0,0 +1,22 @@ +{ + "NullValue": null, + "TrueValue": true, + "FalseValue": false, + "BinaryValue": "T0RhdGE", + "IntegerValue": -128, + "DoubleValue": 3.1415926535897931, + "SingleValue": "INF", + "DecimalValue": 34.95, + "StringValue": "Say \"Hello\",\nthen go", + "DateValue": "2012-12-03", + "DateTimeOffsetValue": "2012-12-03T07:16:23Z", + "DurationValue": "P12DT23H59M59.999999999999S", + "TimeOfDayValue": "07:59:59.999", + "GuidValue": "01234567-89ab-cdef-0123-456789abcdef", + "Int64Value": 0, + "ColorEnumValue": "Yellow", + "GeographyPoint": { + "type": "point", + "coordinates": [142.1, 64.1] + } +} \ No newline at end of file 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 000000000..d0b69608f --- /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)" +} 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 000000000..d04613b8f --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml @@ -0,0 +1,22 @@ + + + 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 000000000..30a50d874 --- /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 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 000000000..149b799b3 --- /dev/null +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml @@ -0,0 +1,31 @@ + + + + 501 + Unsupported functionality + query +
+ + 301 + $search query option not supported + $search + +
+
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml index ed4684456..5d872cafe 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml @@ -19,7 +19,7 @@ under the License. --> - + diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntity.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntity.json deleted file mode 100644 index 4d8499542..000000000 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntity.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')", - "Orders@odata.navigationLink": "Customers('ALFKI')/Orders", - "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref", - "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.navigationLink": "Customers('ALFKI')/Address/Country", - "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref" - } -} \ No newline at end of file diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySet.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySet.json deleted file mode 100644 index b3ddf63cb..000000000 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySet.json +++ /dev/null @@ -1,29 +0,0 @@ -{ -"odata.context": "http://host/service/$metadata#Customers/$entity", -"odata.count": 1, -"value": [ -{ -"odata.context": "http://host/service/$metadata#Customers/$entity", -"odata.id": "Customers('ALFKI')", -"odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", -"odata.editLink": "Customers('ALFKI')", -"Orders@odata.navigationLink": "Customers('ALFKI')/Orders", -"Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref", -"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.navigationLink": "Customers('ALFKI')/Address/Country", - "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref" - } -} -], -"odata.nextLink": "http://host/service/EntitySet?$skiptoken=342r89" -} diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySetWithTwoEntities.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySetWithTwoEntities.json deleted file mode 100644 index 96854acb0..000000000 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySetWithTwoEntities.json +++ /dev/null @@ -1,49 +0,0 @@ -{ -"odata.context": "http://host/service/$metadata#Customers/$entity", -"odata.count": 1, -"value": [ - { - "odata.context": "http://host/service/$metadata#Customers/$entity", - "odata.id": "Customers('ALFKI')", - "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", - "odata.editLink": "Customers('ALFKI')", - "Orders@odata.navigationLink": "Customers('ALFKI')/Orders", - "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref", - "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.navigationLink": "Customers('ALFKI')/Address/Country", - "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref" - } - }, - { - "odata.context": "http://host/service/$metadata#Customers/$entity", - "odata.id": "Customers('MUSKI')", - "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", - "odata.editLink": "Customers('MUSKI')", - "Orders@odata.navigationLink": "Customers('MUSKI')/Orders", - "Orders@odata.associationLink": "Customers('MUSKI')/Orders/$ref", - "ID": "MUSKI", - "CompanyName": "Mustermanns Futterkiste", - "ContactName": "Mustermann Max", - "ContactTitle": "Some Guy", - "Phone": "030-002222", - "Fax": "030-004444", - "Address": { - "Street": "Musterstrasse 42", - "City": "Musterstadt", - "Region": "SomeRegion", - "PostalCode": "D-42042" - } - } -], -"odata.nextLink": "http://host/service/EntitySet?$skiptoken=342r89" -} diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntityWithCollectionOfComplexValues.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntityWithCollectionOfComplexValues.json deleted file mode 100644 index cbdfd1c33..000000000 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntityWithCollectionOfComplexValues.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "odata.context": "http://host/service/$metadata#Customers/$entity", - "odata.id": "Customers('ALFKI')", - "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", - "odata.editLink": "Customers('ALFKI')", - "Orders@odata.navigationLink": "Customers('ALFKI')/Orders", - "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref", - "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.navigationLink": "Customers('ALFKI')/Address/Country", - "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref" - }, { - "Street": "Musterstrasse 42", - "City": "Musterstadt", - "Region": "SomeRegion", - "PostalCode": "D-42042" - } - ] -} \ No newline at end of file diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/primitiveNullValue.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/primitiveNullValue.json deleted file mode 100644 index 5774413a4..000000000 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/primitiveNullValue.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "NullValue" : null -} \ No newline at end of file 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 2e7f066a1..a51cd309f 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", 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 b4c048fff..882c81132 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 @@ -72,6 +74,8 @@ public interface Constants { public static final QName QNAME_ATTR_XML_BASE = new QName(XMLConstants.XML_NS_URI, ATTR_XML_BASE); + public static final String CONTEXT = "context"; + public static final String ATTR_REL = "rel"; public static final String ATTR_TITLE = "title"; @@ -135,45 +139,17 @@ public interface Constants { public static final String ELEM_URI = "uri"; // JSON stuff - public final static String JSON_CONTEXT = "@odata.context"; - public final static String JSON_METADATA = "odata.metadata"; - public final static String JSON_TYPE = "odata.type"; + public final static String JSON_CONTEXT = "@odata.context"; - public final static String JSON_TYPE_SUFFIX = "@" + JSON_TYPE; - - 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_ID = "odata.id"; - - public final static String JSON_READ_LINK = "odata.readLink"; - - public final static String JSON_EDIT_LINK = "odata.editLink"; - - public final static String JSON_MEDIAREAD_LINK = "odata.mediaReadLink"; - - public final static String JSON_MEDIAEDIT_LINK = "odata.mediaEditLink"; - - public final static String JSON_MEDIAEDIT_LINK_SUFFIX = "@" + JSON_MEDIAEDIT_LINK; - - 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_NAVIGATION_LINK_SUFFIX = "@odata.navigationLinkUrl"; + public final static String JSON_METADATA_ETAG = "@odata.metadataEtag"; public final static String JSON_BIND_LINK_SUFFIX = "@odata.bind"; - public final static String JSON_ASSOCIATION_LINK_SUFFIX = "@odata.associationLinkUrl"; - public final static String JSON_NULL = "odata.null"; - public final static String JSON_VALUE = "value"; + public final static String VALUE = "value"; public final static String JSON_URL = "url"; @@ -192,6 +168,12 @@ public interface Constants { // Atom stuff public final static String ATOM_ELEM_ENTRY = "entry"; + public final static String ATOM_ELEM_ENTRY_REF = "ref"; + + public final static String ATOM_ATTR_ID = "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); public final static String ATOM_ELEM_FEED = "feed"; @@ -240,4 +222,13 @@ public interface Constants { public static final String ATOM_ATTR_ETAG = "etag"; + 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"; + } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java new file mode 100644 index 000000000..be3476b64 --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java @@ -0,0 +1,76 @@ +/* + * 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.net.URI; + +/** + * Outermost response object container. + */ +public class Container { + + private final URI contextURL; + + private final String metadataETag; + + private final T object; + + public Container(final URI contextURL, final String metadataETag, final T object) { + this.contextURL = contextURL; + this.metadataETag = metadataETag; + this.object = object; + } + + /** + * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a + * fragment identifying the relevant portion of the metadata document. + *
+ * Request payloads generally do not require context URLs as the type of the payload can generally be determined from + * the request URL. + *
+ * For details on how the context URL is used to describe a payload, see the relevant sections in the particular + * format. + * + * @return context URL. + */ + public URI getContextURL() { + return contextURL; + } + + /** + * An ETag header MAY also be returned on a metadata document request or service document request to allow the client + * subsequently to make a conditional request for the metadata or service document. Clients can also compare the value + * of the ETag header returned from a metadata document request to the metadata ETag returned in a response in order + * to verify the version of the metadata used to generate that response. + * + * @return metadata ETag. + */ + public String getMetadataETag() { + return metadataETag; + } + + /** + * Gets contained object. + * + * @return contained object. + */ + public T getObject() { + return object; + } +} 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 ea73b7dfc..5e24e8a76 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 @@ -53,12 +53,19 @@ public interface Entry { void setType(String type); /** - * Gest entry ID. + * Gets entry ID. * * @return entry ID. */ String getId(); + /** + * Sets entry ID. + * + * @param id entry ID. + */ + void setId(String id); + /** * Gets entry self link. * @@ -158,6 +165,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. * diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EnumValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EnumValue.java new file mode 100644 index 000000000..2f13fa752 --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EnumValue.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.data; + +public interface EnumValue extends Value { + + @Override + String get(); +} diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java index 4e98ac603..4f6a54235 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java @@ -71,5 +71,4 @@ public interface Feed { * @param next next link. */ void setNext(URI next); - } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java index fa7538db9..c1ceef0b0 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java @@ -24,10 +24,6 @@ import org.apache.olingo.commons.api.edm.geo.Geospatial; public final class GeoUtils { - private GeoUtils() { - // Empty private constructor for static utility classes - } - public static Geospatial.Dimension getDimension(final EdmPrimitiveTypeKind type) { Geospatial.Dimension dimension; @@ -87,4 +83,9 @@ public final class GeoUtils { return type; } + + private GeoUtils() { + // Empty private constructor for static utility classes + } + } 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 045751da4..b02f1ba28 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 @@ -22,10 +22,12 @@ public interface Value { boolean isNull(); - boolean isSimple(); + boolean isPrimitive(); boolean isGeospatial(); + boolean isEnum(); + boolean isComplex(); boolean isCollection(); @@ -34,7 +36,9 @@ public interface Value { NullValue asNull(); - PrimitiveValue asSimple(); + PrimitiveValue asPrimitive(); + + EnumValue asEnum(); GeospatialValue asGeospatial(); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataPayload.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataPayload.java new file mode 100644 index 000000000..9bc177cea --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataPayload.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; + +import java.net.URI; + +/** + * OData entity. + */ +public abstract class AbstractODataPayload extends ODataItem { + + private static final long serialVersionUID = -8234709365887433612L; + + /** + * Context URL. + */ + private URI contextURL; + + public AbstractODataPayload(final String name) { + super(name); + } + + /** + * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a + * fragment identifying the relevant portion of the metadata document. + * + * @return context URL. + */ + public URI getContextURL() { + return contextURL; + } + + public void setContextURL(final URI contextURL) { + this.contextURL = contextURL; + } +} 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 ab77d7fa8..4fb9de956 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 @@ -30,6 +30,20 @@ public abstract class AbstractODataValue implements ODataValue { private static final long serialVersionUID = 7445422004232581877L; + /** + * Type name; + */ + private final String typeName; + + public AbstractODataValue(final String typeName) { + this.typeName = typeName; + } + + @Override + public String getTypeName() { + return typeName; + } + /** * Check is is a primitive value. * @@ -50,26 +64,6 @@ public abstract class AbstractODataValue implements ODataValue { return isPrimitive() ? (ODataPrimitiveValue) this : null; } - /** - * Check is is a geospatail value. - * - * @return 'TRUE' if geospatail; 'FALSE' otherwise. - */ - @Override - public boolean isGeospatial() { - return (this instanceof ODataGeospatialValue); - } - - /** - * Casts to geospatail value. - * - * @return geospatail value. - */ - @Override - public ODataGeospatialValue asGeospatial() { - return isGeospatial() ? (ODataGeospatialValue) this : null; - } - /** * Check is is a complex value. * @@ -85,9 +79,10 @@ public abstract class AbstractODataValue implements ODataValue { * * @return complex value. */ +// @SuppressWarnings("unchecked") @Override - public ODataComplexValue asComplex() { - return isComplex() ? (ODataComplexValue) this : null; + public ODataComplexValue asComplex() { + return isComplex() ? (ODataComplexValue) this : null; } /** @@ -105,9 +100,10 @@ public abstract class AbstractODataValue implements ODataValue { * * @return collection value. */ +// @SuppressWarnings("unchecked") @Override - public ODataCollectionValue asCollection() { - return isCollection() ? (ODataCollectionValue) this : null; + public ODataCollectionValue asCollection() { + return isCollection() ? (ODataCollectionValue) this : null; } @Override 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 000000000..6d832c8d4 --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java @@ -0,0 +1,215 @@ +/* + * 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, null otherwise + */ + ODataOperation getOperation(String title); + + /** + * Gets operations. + * + * @return operations. + */ + List getOperations(); + + /** + * Searches for property with given name. + * + * @param name property to look for + * @return property if found with given name, null otherwise + */ + CommonODataProperty getProperty(String name); + + /** + * Returns OData entity properties. + * + * @return OData entity properties. + */ + List getProperties(); + + /** + * Puts the given link into one of available lists, based on its type. + * + * @param link to be added + * @return true 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 true if the given link was contained in one of available lists + */ + boolean removeLink(ODataLink link); + + /** + * Gets association link with given name, if available, otherwise null. + * + * @param name candidate link name + * @return association link with given name, if available, otherwise null + */ + ODataLink getAssociationLink(String name); + + /** + * Returns all entity association links. + * + * @return OData entity links. + */ + List getAssociationLinks(); + + /** + * Gets navigation link with given name, if available, otherwise null. + * + * @param name candidate link name + * @return navigation link with given name, if available, otherwise null + */ + ODataLink getNavigationLink(String name); + + /** + * Returns all entity navigation links (including inline entities / feeds). + * + * @return OData entity links. + */ + List getNavigationLinks(); + + /** + * Gets media-edit link with given name, if available, otherwise null. + * + * @param name candidate link name + * @return media-edit link with given name, if available, otherwise null + */ + ODataLink getEditMediaLink(String name); + + /** + * Returns all entity media edit links. + * + * @return OData entity links. + */ + List 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); + + /** + * 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); + +} 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 000000000..39677487c --- /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 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); + +} 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/CommonODataObjectFactory.java similarity index 79% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java index b38a5e8af..434906e18 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/CommonODataObjectFactory.java @@ -22,20 +22,15 @@ import java.net.URI; /** * Entry point for generating OData domain objects. - * - * @see ODataEntitySet - * @see ODataEntity - * @see ODataProperty - * @see ODataLink */ -public interface ODataObjectFactory { +public interface CommonODataObjectFactory { /** * Instantiates a new entity set. * * @return entity set. */ - ODataEntitySet newEntitySet(); + CommonODataEntitySet newEntitySet(); /** * Instantiates a new entity set. @@ -43,7 +38,7 @@ public interface ODataObjectFactory { * @param next next link. * @return entity set. */ - ODataEntitySet newEntitySet(URI next); + CommonODataEntitySet newEntitySet(URI next); /** * Instantiates a new entity. @@ -51,7 +46,7 @@ public interface ODataObjectFactory { * @param name OData entity name. * @return entity. */ - ODataEntity newEntity(String name); + CommonODataEntity newEntity(String name); /** * Instantiates a new entity. @@ -60,7 +55,7 @@ public interface ODataObjectFactory { * @param link self link. * @return entity. */ - ODataEntity newEntity(String name, URI link); + CommonODataEntity newEntity(String name, URI link); /** * Instantiates a new in-line entity set. @@ -70,7 +65,7 @@ public interface ODataObjectFactory { * @param entitySet entity set. * @return in-line entity set. */ - ODataInlineEntitySet newInlineEntitySet(String name, URI link, ODataEntitySet entitySet); + ODataInlineEntitySet newInlineEntitySet(String name, URI link, CommonODataEntitySet entitySet); /** * Instantiates a new in-line entity set. @@ -81,7 +76,7 @@ public interface ODataObjectFactory { * @param entitySet entity set. * @return in-line entity set. */ - ODataInlineEntitySet newInlineEntitySet(String name, URI baseURI, String href, ODataEntitySet entitySet); + ODataInlineEntitySet newInlineEntitySet(String name, URI baseURI, String href, CommonODataEntitySet entitySet); /** * Instantiates a new in-line entity. @@ -91,7 +86,7 @@ public interface ODataObjectFactory { * @param entity entity. * @return in-line entity. */ - ODataInlineEntity newInlineEntity(String name, URI link, ODataEntity entity); + ODataInlineEntity newInlineEntity(String name, URI link, CommonODataEntity entity); /** * Instantiates a new in-line entity. @@ -102,7 +97,7 @@ public interface ODataObjectFactory { * @param entity entity. * @return in-line entity. */ - ODataInlineEntity newInlineEntity(String name, URI baseURI, String href, ODataEntity entity); + ODataInlineEntity newInlineEntity(String name, URI baseURI, String href, CommonODataEntity entity); /** * Instantiates a new entity navigation link. @@ -130,7 +125,7 @@ public interface ODataObjectFactory { * @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. @@ -140,7 +135,7 @@ public interface ODataObjectFactory { * @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. @@ -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. * @@ -187,16 +188,7 @@ public interface ODataObjectFactory { * @param value primitive value. * @return primitive property. */ - ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value); - - /** - * Instantiates a new primitive property. - * - * @param name name. - * @param value geospatial value. - * @return primitive property. - */ - ODataProperty newPrimitiveProperty(String name, ODataGeospatialValue value); + CommonODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value); /** * Instantiates a new complex property. @@ -205,7 +197,7 @@ public interface ODataObjectFactory { * @param value value. * @return complex property. */ - ODataProperty newComplexProperty(String name, ODataComplexValue value); + CommonODataProperty newComplexProperty(String name, ODataComplexValue value); /** * Instantiates a new collection property. @@ -214,5 +206,5 @@ public interface ODataObjectFactory { * @param value value. * @return collection property. */ - ODataProperty newCollectionProperty(String name, ODataCollectionValue value); + CommonODataProperty newCollectionProperty(String name, ODataCollectionValue value); } 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 000000000..8eae93e15 --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java @@ -0,0 +1,77 @@ +/* + * 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(); + + /** + * Checks if has complex value. + * + * @return 'TRUE' if has complex value; 'FALSE' otherwise. + */ + boolean hasComplexValue(); + +} 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 f5831871d..088bbc0f0 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,31 @@ */ package org.apache.olingo.commons.api.domain; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - /** * OData collection property value. + * + * @param The actual ODataValue interface. */ -public class ODataCollectionValue extends AbstractODataValue implements Iterable { - - private static final long serialVersionUID = -3665659846001987187L; - - /** - * Type name; - */ - private final String typeName; - - /** - * Values. - */ - private final List values = new ArrayList(); - - /** - * Constructor. - * - * @param typeName type name. - */ - public ODataCollectionValue(final String typeName) { - this.typeName = typeName; - } +public interface ODataCollectionValue extends ODataValue, Iterable { /** * 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); - } - } - - /** - * Value iterator. - * - * @return value iterator. - */ - @Override - public Iterator iterator() { - return values.iterator(); - } - - /** - * Gets value type name. - * - * @return value type name. - */ - public String getType() { - return typeName; - } - - /** - * Gets collection size. - * - * @return collection size. - */ - public int size() { - return values.size(); - } + void add(ODataValue value); /** * Checks if collection is empty. * * @return 'TRUE' if empty; 'FALSE' otherwise. */ - public boolean isEmpty() { - return values.isEmpty(); - } + boolean isEmpty(); + + /** + * Gets collection size. + * + * @return collection size. + */ + int size(); } 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 b97371898..7eb02c0ec 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,19 @@ */ package org.apache.olingo.commons.api.domain; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; - /** * OData complex property value. + * + * @param The actual ODataProperty interface. */ -public class ODataComplexValue extends AbstractODataValue implements Iterable { - - private static final long serialVersionUID = -1878555027714020431L; - - /** - * Type name. - */ - private final String typeName; - - /** - * Complex type fields. - */ - private final Map fields = new LinkedHashMap(); - - /** - * Constructor. - * - * @param type type name. - */ - public ODataComplexValue(final String typeName) { - this.typeName = typeName; - } +public interface ODataComplexValue extends ODataValue, Iterable { /** * 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(OP field); /** * Gets field. @@ -63,35 +38,13 @@ public class ODataComplexValue extends AbstractODataValue implements Iterable iterator() { - return fields.values().iterator(); - } - - /** - * Gest value type name. - * - * @return value type name. - */ - public String getType() { - return typeName; - } + OP get(String name); /** * Gets number of fields. * * @return number of fields. */ - public int size() { - return fields.size(); - } + int size(); + } 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 d3b146d99..000000000 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java +++ /dev/null @@ -1,120 +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.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 ODataItem implements ODataInvokeResult { - - private static final long serialVersionUID = 9039605899821494024L; - - /** - * Link to the next page. - */ - protected URI next; - - /** - * Number of ODataEntities contained in this feed. If $inlinecount was requested, this value comes from - * there. - */ - protected Integer count; - - /** - * OData entities contained in this feed. - */ - protected List entities = new ArrayList(); - - /** - * Constructor. - */ - public ODataEntitySet() { - super(null); - } - - /** - * Constructor. - * - * @param next next link. - */ - public ODataEntitySet(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. - */ - public URI getNext() { - return next; - } - - /** - * Sets in-line count. - * - * @param count in-line count value. - */ - public void setCount(final int count) { - this.count = count; - } - - /** - * 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); - } - - /** - * Removes an entity. - * - * @param entity entity to be removed. - * @return 'TRUE' in case of success; 'FALSE' otherwise. - */ - public boolean removeEntity(final ODataEntity entity) { - return entities.remove(entity); - } - - /** - * Gets contained entities. - * - * @return feed entries. - */ - public List getEntities() { - return entities; - } -} 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 29939643c..fc309d30d 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 @@ -30,38 +30,18 @@ public interface ODataError { */ String getCode(); - /** - * Gets error message language. - * - * @return error message language. - */ - String getMessageLang(); - /** * Gets error message. * * @return error message. */ - String getMessageValue(); + String getMessage(); /** - * Gets inner error message. + * Gets error target. * - * @return inner error message. + * @return error message. */ - String getInnerErrorMessage(); + String getTarget(); - /** - * Gets inner error type. - * - * @return inner error type. - */ - String getInnerErrorType(); - - /** - * Gets inner error stack-trace. - * - * @return inner error stack-trace - */ - String getInnerErrorStacktrace(); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java deleted file mode 100644 index 756390719..000000000 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.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 org.apache.olingo.commons.api.edm.EdmGeospatialType; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.apache.olingo.commons.api.edm.geo.Geospatial; - -public interface ODataGeospatialValue extends ODataValue { - - interface Builder { - - Builder setType(EdmPrimitiveTypeKind type); - - Builder setValue(Geospatial value); - - ODataGeospatialValue build(); - - } - - EdmPrimitiveTypeKind getTypeKind(); - - EdmGeospatialType getType(); - - /** - * Returns the current geospatial value. - * - * @return the current geospatial value. - */ - Geospatial toValue(); - - /** - * Returns the current value casted to the given type. - * - * @param cast type - * @param reference class reference - * @return the current value as typed java instance - */ - T toCastValue(Class reference); - -} 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 46e29dd2b..67e5bb481 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; } } 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 1ace20bc0..24ca836aa 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; } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java index b40eeb785..6ab2376d0 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java @@ -39,16 +39,16 @@ public abstract class ODataItem implements Serializable { */ protected static final Logger LOG = LoggerFactory.getLogger(ODataItem.class); - /** - * OData item self link. - */ - protected URI link; - /** * OData entity name/type. */ private final String name; + /** + * OData item self link. + */ + protected URI link; + /** * Constructor. * @@ -58,6 +58,15 @@ public abstract class ODataItem implements Serializable { this.name = name; } + /** + * Returns OData entity name. + * + * @return entity name. + */ + public String getName() { + return name; + } + /** * Returns self link. * @@ -76,15 +85,6 @@ public abstract class ODataItem implements Serializable { this.link = link; } - /** - * Returns OData entity name. - * - * @return entity name. - */ - public String getName() { - return name; - } - /** * {@inheritDoc } */ 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 9e6845427..d46351136 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 @@ -98,7 +98,6 @@ public class ODataLink extends ODataItem { return uri.normalize(); } - /** * Link type. */ @@ -169,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. * @@ -186,5 +193,4 @@ public class ODataLink extends ODataItem { public String getMediaETag() { return mediaETag; } - } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java index d173e50bb..99126f745 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java @@ -21,11 +21,15 @@ package org.apache.olingo.commons.api.domain; public enum ODataPropertyType { /** - * Primitive (including geospatial and enum). + * Primitive (including geospatial). */ PRIMITIVE, /** - * Collection + * Enum. + */ + ENUM, + /** + * Collection. */ COLLECTION, /** 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 13f807b92..281bd18eb 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 entitySets = new HashMap(); private final Map functionImports = new HashMap(); @@ -37,22 +33,6 @@ public class ODataServiceDocument { private final Map relatedServiceDocuments = new HashMap(); - 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 getEntitySets() { return entitySets; } 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 e1c9be99c..072797676 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 @@ -25,6 +25,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. * @@ -39,20 +46,6 @@ public interface ODataValue extends Serializable { */ ODataPrimitiveValue asPrimitive(); - /** - * Check is is a geospatail value. - * - * @return 'TRUE' if geospatail; 'FALSE' otherwise. - */ - boolean isGeospatial(); - - /** - * Casts to geospatail value. - * - * @return geospatail value. - */ - ODataGeospatialValue asGeospatial(); - /** * Check is is a collection value. * @@ -63,9 +56,10 @@ public interface ODataValue extends Serializable { /** * Casts to collection value. * + * @param The actual ODataValue interface. * @return collection value. */ - ODataCollectionValue asCollection(); + ODataCollectionValue asCollection(); /** * Check is is a complex value. @@ -77,8 +71,9 @@ public interface ODataValue extends Serializable { /** * Casts to complex value. * + * @param The actual ODataProperty interface. * @return complex value. */ - ODataComplexValue asComplex(); + ODataComplexValue asComplex(); } 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 000000000..18ba67b4c --- /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 getProperties(); + +} 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 000000000..dae091944 --- /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 getEntities(); + +} 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 000000000..31f5ba19b --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.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.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 { + + @Override + ODataEntitySet newEntitySet(); + + @Override + ODataEntitySet newEntitySet(URI next); + + @Override + ODataEntity newEntity(String name); + + @Override + ODataEntity newEntity(String name, URI link); + + @Override + ODataComplexValue newComplexValue(String typeName); + + @Override + ODataCollectionValue newCollectionValue(String typeName); + + @Override + ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value); + + @Override + ODataProperty newComplexProperty(String name, ODataComplexValue value); + + @Override + ODataProperty newCollectionProperty(String name, ODataCollectionValue value); + +} 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 000000000..46f1c393d --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.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 getCollectionValue(); + + /** + * Gets complex value. + * + * @return complex value if exists; null otherwise. + */ + ODataComplexValue getComplexValue(); +} 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 000000000..df9e80123 --- /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 getProperties(); + + /** + * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended + * to the resource path. + *
+ * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found. + *
+ * 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. + *
+ * 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); + +} 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 000000000..97ac19246 --- /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 getEntities(); + +} 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 000000000..2e3699d61 --- /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(); +} 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 000000000..67adf57ec --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.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.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; + +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); + + ODataEnumValue newEnumValue(String typeName, String value); + + @Override + ODataComplexValue newComplexValue(String typeName); + + @Override + ODataCollectionValue newCollectionValue(String typeName); + + @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); + +} 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 000000000..4666e6ebc --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java @@ -0,0 +1,54 @@ +/* + * 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; +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 getCollectionValue(); + + /** + * Gets complex value. + * + * @return complex value if exists; null otherwise. + */ + ODataComplexValue getComplexValue(); + + /** + * 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(); +} 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 000000000..1535e1063 --- /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(); +} 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 87c9d34a9..1c66b80f3 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}. @@ -32,6 +34,11 @@ public interface EdmBindingTarget extends EdmNamed { */ EdmBindingTarget getRelatedBindingTarget(String path); + /** + * @return all navigation property bindings + */ + List getNavigationPropertyBindings(); + /** * Returns the entity container this target is contained in. * 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 00afbc877..84dfea4d5 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 getActionImports(); + /** + * @return the {@link FullQualifiedName} of the parentContainer or null if no parent is specified + */ + FullQualifiedName getParentContainerName(); + } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java index cca20d91b..dc1806d93 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java @@ -40,4 +40,9 @@ public interface EdmEnumType extends EdmPrimitiveType { * @return the {@link EdmPrimitiveType} this {@link EdmEnumType} is based upon */ EdmPrimitiveType getUnderlyingType(); + + /** + * @return true if flags is set + */ + boolean isFlags(); } 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 52c645f1e..5f54154ea 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 *
@@ -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 getReferentialConstraints(); + } 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 000000000..2ebcf2bcf --- /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(); + +} 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 000000000..e479efbcd --- /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(); + +} 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 d637814cf..c6354ecbe 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 @@ -48,6 +48,29 @@ public enum ODataServiceVersion { public static final String MEDIA_EDIT_LINK_REL = "mediaEditLinkRel"; + public static final String JSON_TYPE = "jsonType"; + + 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"; + + public static final String JSON_MEDIAREAD_LINK = "jsonMediaReadLink"; + + 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"; + public static final String JSON_ERROR = "jsonError"; + private static final Map V30_NAMESPACES = Collections.unmodifiableMap(new HashMap() { private static final long serialVersionUID = 3109256773218160485L; @@ -62,6 +85,26 @@ public enum ODataServiceVersion { } }); + private static final Map V30_JSON = Collections.unmodifiableMap(new HashMap() { + + private static final long serialVersionUID = 3109256773218160485L; + + { + 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"); + put(JSON_ERROR, "odata.error"); + } + }); + private static final Map V40_NAMESPACES = Collections.unmodifiableMap(new HashMap() { private static final long serialVersionUID = 3109256773218160485L; @@ -76,6 +119,26 @@ public enum ODataServiceVersion { } }); + private static final Map V40_JSON = Collections.unmodifiableMap(new HashMap() { + + private static final long serialVersionUID = 3109256773218160485L; + + { + 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"); + put(JSON_ERROR, "error"); + } + }); + /** * Validates format and range of a data service version string. * @@ -135,6 +198,14 @@ public enum ODataServiceVersion { : V40_NAMESPACES; } + public Map getJSONMap() { + return this == V10 || this == V20 + ? Collections.emptyMap() + : this == V30 + ? V30_JSON + : V40_JSON; + } + @Override public String toString() { return version; diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java index 82a13fe80..cbc56851a 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java @@ -31,18 +31,10 @@ public abstract class ComposedGeospatial extends Geospatia protected final List geospatials; - /** - * Constructor. - * - * @param dimension dimension. - * @param type type. - * @param crs crs. - * @param geospatials geospatials info. - */ - protected ComposedGeospatial(final Dimension dimension, final Type type, final String crs, + protected ComposedGeospatial(final Dimension dimension, final Type type, final Integer srid, final List geospatials) { - super(dimension, type, crs); + super(dimension, type, srid); this.geospatials = new ArrayList(); if (geospatials != null) { this.geospatials.addAll(geospatials); @@ -65,14 +57,4 @@ public abstract class ComposedGeospatial extends Geospatia public boolean isEmpty() { return geospatials.isEmpty(); } - - /** - * {@inheritDoc } - */ - @Override - public void setSrid(final Integer srid) { - for (Geospatial geospatial : this.geospatials) { - geospatial.setSrid(srid); - } - } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java index 62de5ec3d..19b98dd71 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java @@ -75,23 +75,22 @@ public abstract class Geospatial implements Serializable { protected final Type type; - protected String crs; - /** * Null value means it is expected to vary per instance. */ - protected Integer srid; + protected final Integer srid; /** * Constructor. * * @param dimension dimension. * @param type type. + * @param srid SRID */ - protected Geospatial(final Dimension dimension, final Type type, final String crs) { + protected Geospatial(final Dimension dimension, final Type type, final Integer srid) { this.dimension = dimension; this.type = type; - this.crs = crs; + this.srid = srid; } /** @@ -114,15 +113,6 @@ public abstract class Geospatial implements Serializable { return type; } - /** - * Gets CRS. - * - * @return CRS - */ - public String getCrs() { - return crs; - } - /** * Gets s-rid. * @@ -132,36 +122,18 @@ public abstract class Geospatial implements Serializable { return srid; } - /** - * Sets s-rid. - * - * @param srid s-rid. - */ - public void setSrid(final Integer srid) { - this.srid = srid; - } - public abstract EdmPrimitiveTypeKind getEdmPrimitiveTypeKind(); - /** - * {@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); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java index b3e3f9fd5..5b0b85763 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java @@ -28,21 +28,14 @@ public class GeospatialCollection extends ComposedGeospatial { private static final long serialVersionUID = -9181547636133878977L; - /** - * Constructor. - * - * @param dimension dimension. - * @param crs crs. - * @param geospatials geospatials info. - */ - public GeospatialCollection(final Dimension dimension, final String crs, final List geospatials) { - super(dimension, Type.GEOSPATIALCOLLECTION, crs, geospatials); + public GeospatialCollection(final Dimension dimension, final Integer srid, final List geospatials) { + super(dimension, Type.GEOSPATIALCOLLECTION, srid, geospatials); } @Override public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() { return dimension == Dimension.GEOGRAPHY - ? EdmPrimitiveTypeKind.GeographyCollection - : EdmPrimitiveTypeKind.GeometryCollection; + ? EdmPrimitiveTypeKind.GeographyCollection + : EdmPrimitiveTypeKind.GeometryCollection; } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java index 297a96260..bc6afafcc 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java @@ -25,8 +25,8 @@ public class LineString extends ComposedGeospatial { private static final long serialVersionUID = 3207958185407535907L; - public LineString(final Dimension dimension, final String crs, final List points) { - super(dimension, Type.LINESTRING, crs, points); + public LineString(final Dimension dimension, final Integer srid, final List points) { + super(dimension, Type.LINESTRING, srid, points); } @Override diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java index 2f98d63fd..d38f3b013 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java @@ -25,15 +25,15 @@ public class MultiLineString extends ComposedGeospatial { private static final long serialVersionUID = -5042414471218124125L; - public MultiLineString(final Dimension dimension, final String crs, final List lineStrings) { - super(dimension, Type.MULTILINESTRING, crs, lineStrings); + public MultiLineString(final Dimension dimension, final Integer srid, final List lineStrings) { + super(dimension, Type.MULTILINESTRING, srid, lineStrings); } @Override public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() { return dimension == Dimension.GEOGRAPHY - ? EdmPrimitiveTypeKind.GeographyMultiLineString - : EdmPrimitiveTypeKind.GeometryMultiLineString; + ? EdmPrimitiveTypeKind.GeographyMultiLineString + : EdmPrimitiveTypeKind.GeometryMultiLineString; } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java index 999f24bcb..7229d05b2 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java @@ -25,8 +25,8 @@ public class MultiPoint extends ComposedGeospatial { private static final long serialVersionUID = 4951011255142116129L; - public MultiPoint(final Dimension dimension, final String crs, final List points) { - super(dimension, Type.MULTIPOINT, crs, points); + public MultiPoint(final Dimension dimension, final Integer srid, final List points) { + super(dimension, Type.MULTIPOINT, srid, points); } @Override diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java index fd0fdae51..dbbfb2450 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java @@ -25,14 +25,14 @@ public class MultiPolygon extends ComposedGeospatial { private static final long serialVersionUID = -160184788048512883L; - public MultiPolygon(final Dimension dimension, final String crs, final List polygons) { - super(dimension, Type.MULTIPOLYGON, crs, polygons); + public MultiPolygon(final Dimension dimension, final Integer srid, final List polygons) { + super(dimension, Type.MULTIPOLYGON, srid, polygons); } @Override public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() { return dimension == Dimension.GEOGRAPHY - ? EdmPrimitiveTypeKind.GeographyMultiPolygon - : EdmPrimitiveTypeKind.GeometryMultiPolygon; + ? EdmPrimitiveTypeKind.GeographyMultiPolygon + : EdmPrimitiveTypeKind.GeometryMultiPolygon; } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java index a9e0c39e6..c8c8a3725 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java @@ -40,8 +40,8 @@ public class Point extends Geospatial { */ private double z; - public Point(final Dimension dimension, final String crs) { - super(dimension, Type.POINT, crs); + public Point(final Dimension dimension, final Integer srid) { + super(dimension, Type.POINT, srid); } public double getX() { @@ -71,7 +71,7 @@ public class Point extends Geospatial { @Override public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() { return dimension == Dimension.GEOGRAPHY - ? EdmPrimitiveTypeKind.GeographyPoint - : EdmPrimitiveTypeKind.GeometryPoint; + ? EdmPrimitiveTypeKind.GeographyPoint + : EdmPrimitiveTypeKind.GeometryPoint; } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java index 2501d4eae..6d93ef25a 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java @@ -32,18 +32,12 @@ public class Polygon extends Geospatial { final ComposedGeospatial exterior; - /** - * Constructor. - * - * @param dimension dimension. - * @param crs crs. - * @param interior interior points. - * @param exterior exterior points. - */ - public Polygon(final Dimension dimension, final String crs, final List interior, final List exterior) { - super(dimension, Type.POLYGON, crs); - this.interior = new MultiPoint(dimension, crs, interior); - this.exterior = new MultiPoint(dimension, crs, exterior); + public Polygon(final Dimension dimension, final Integer srid, + final List interior, final List exterior) { + + super(dimension, Type.POLYGON, srid); + this.interior = new MultiPoint(dimension, srid, interior); + this.exterior = new MultiPoint(dimension, srid, exterior); } /** diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java index 21ed548c5..c41cfc5ca 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java @@ -18,7 +18,12 @@ */ package org.apache.olingo.commons.api.format; -public interface ContentType { +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Map; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; + +public abstract class ContentType { public static final String APPLICATION_ATOM_XML = "application/atom+xml"; @@ -44,4 +49,25 @@ public interface ContentType { public static final String WILDCARD = "*/*"; + public static final EnumMap> formatPerVersion = + new EnumMap>(ODataServiceVersion.class); + + static { + + final Map v3 = new HashMap(); + v3.put(ODataPubFormat.JSON_NO_METADATA.name(), ContentType.APPLICATION_JSON + ";odata=nometadata"); + v3.put(ODataPubFormat.JSON.name(), ContentType.APPLICATION_JSON + ";odata=minimalmetadata"); + v3.put(ODataPubFormat.JSON_FULL_METADATA.name(), ContentType.APPLICATION_JSON + ";odata=fullmetadata"); + v3.put(ODataPubFormat.ATOM.name(), ContentType.APPLICATION_ATOM_XML); + v3.put(ODataFormat.XML.name(), ContentType.APPLICATION_XML); + formatPerVersion.put(ODataServiceVersion.V30, v3); + + final Map v4 = new HashMap(); + v4.put(ODataPubFormat.JSON_NO_METADATA.name(), ContentType.APPLICATION_JSON + ";odata.metadata=none"); + v4.put(ODataPubFormat.JSON.name(), ContentType.APPLICATION_JSON + ";odata.metadata=minimal"); + v4.put(ODataPubFormat.JSON_FULL_METADATA.name(), ContentType.APPLICATION_JSON + ";odata.metadata=full"); + v4.put(ODataPubFormat.ATOM.name(), ContentType.APPLICATION_ATOM_XML); + v4.put(ODataFormat.XML.name(), ContentType.APPLICATION_XML); + formatPerVersion.put(ODataServiceVersion.V40, v4); + } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java index 7401e0b1a..301ada9e1 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java @@ -23,39 +23,43 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; /** * Available formats to be used in various contexts. */ -public enum ODataFormat implements Format{ +public enum ODataFormat implements Format { /** * JSON format with no metadata. */ - JSON_NO_METADATA(ContentType.APPLICATION_JSON + ";odata=nometadata"), + JSON_NO_METADATA, /** * JSON format with minimal metadata (default). */ - JSON(ContentType.APPLICATION_JSON + ";odata=minimalmetadata"), + JSON, /** * JSON format with no metadata. */ - JSON_FULL_METADATA(ContentType.APPLICATION_JSON + ";odata=fullmetadata"), + JSON_FULL_METADATA, /** * XML format. */ - XML(ContentType.APPLICATION_XML); - - private final String format; - - ODataFormat(final String format) { - this.format = format; - } + XML; /** * Gets format as a string. * + * @param version OData service version. * @return format as a string. */ + @Override + public String toString(final ODataServiceVersion version) { + if (version.ordinal() < ODataServiceVersion.V30.ordinal()) { + throw new IllegalArgumentException("Unsupported version " + version); + } + + return ContentType.formatPerVersion.get(version).get(this.name()); + } + @Override public String toString() { - return format; + throw new UnsupportedOperationException(); } /** @@ -82,7 +86,8 @@ public enum ODataFormat implements Format{ if (result == null) { final String candidate = _format.toString(); for (ODataFormat value : values()) { - if (candidate.equals(value.toString())) { + if (candidate.equals(value.toString(ODataServiceVersion.V30)) + || candidate.equals(value.toString(ODataServiceVersion.V40))) { result = value; } } @@ -94,9 +99,4 @@ public enum ODataFormat implements Format{ return result; } - - @Override - public String toString(final ODataServiceVersion version) { - return this.toString(); - } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java index 62dc61b64..4b4c06328 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java @@ -18,7 +18,6 @@ */ package org.apache.olingo.commons.api.format; -import java.util.EnumMap; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; /** @@ -29,42 +28,24 @@ public enum ODataPubFormat implements Format { /** * JSON format with no metadata. */ - JSON_NO_METADATA(), + JSON_NO_METADATA, /** * JSON format with minimal metadata (default). */ - JSON(), + JSON, /** * JSON format with no metadata. */ - JSON_FULL_METADATA(), + JSON_FULL_METADATA, /** * Atom format. */ - ATOM(); - - final static EnumMap> formatPerVersion = - new EnumMap>(ODataServiceVersion.class); - - static { - final EnumMap v3 = new EnumMap(ODataPubFormat.class); - v3.put(JSON_NO_METADATA, ContentType.APPLICATION_JSON + ";odata=nometadata"); - v3.put(JSON, ContentType.APPLICATION_JSON + ";odata=minimalmetadata"); - v3.put(JSON_FULL_METADATA, ContentType.APPLICATION_JSON + ";odata=fullmetadata"); - v3.put(ATOM, ContentType.APPLICATION_ATOM_XML); - formatPerVersion.put(ODataServiceVersion.V30, v3); - - final EnumMap v4 = new EnumMap(ODataPubFormat.class); - v4.put(JSON_NO_METADATA, ContentType.APPLICATION_JSON + ";odata.metadata=none"); - v4.put(JSON, ContentType.APPLICATION_JSON + ";odata.metadata=minimal"); - v4.put(JSON_FULL_METADATA, ContentType.APPLICATION_JSON + ";odata.metadata=full"); - v4.put(ATOM, ContentType.APPLICATION_ATOM_XML); - formatPerVersion.put(ODataServiceVersion.V40, v4); - } + ATOM; /** * Gets format as a string. * + * @param version OData service version. * @return format as a string. */ @Override @@ -73,7 +54,7 @@ public enum ODataPubFormat implements Format { throw new IllegalArgumentException("Unsupported version " + version); } - return ODataPubFormat.formatPerVersion.get(version).get(this); + return ContentType.formatPerVersion.get(version).get(this.name()); } @Override diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java index dfefb7890..4b30ddd0c 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java @@ -20,6 +20,7 @@ package org.apache.olingo.commons.api.op; import java.io.InputStream; import java.io.Serializable; +import org.apache.olingo.commons.api.data.Container; import org.apache.olingo.commons.api.data.Entry; import org.apache.olingo.commons.api.domain.ODataError; import org.apache.olingo.commons.api.data.Feed; @@ -39,7 +40,7 @@ public interface CommonODataDeserializer extends Serializable { * @param format Atom or JSON * @return Feed instance. */ - Feed toFeed(InputStream input, ODataPubFormat format); + Container toFeed(InputStream input, ODataPubFormat format); /** * Gets an entry object from the given InputStream. @@ -48,7 +49,7 @@ public interface CommonODataDeserializer extends Serializable { * @param format Atom or JSON * @return Entry instance. */ - Entry toEntry(InputStream input, ODataPubFormat format); + Container toEntry(InputStream input, ODataPubFormat format); /** * Gets a property object from the given InputStream. @@ -57,7 +58,7 @@ public interface CommonODataDeserializer extends Serializable { * @param format XML or JSON * @return Property instance. */ - Property toProperty(InputStream input, ODataFormat format); + Container toProperty(InputStream input, ODataFormat format); /** * Gets the ODataError object represented by the given InputStream. @@ -67,5 +68,4 @@ public interface CommonODataDeserializer extends Serializable { * @return */ ODataError toError(InputStream input, boolean isXML); - } 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 940d8a539..f4944d62e 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 @@ -34,6 +34,8 @@ abstract class AbstractAtomDealer { protected final QName etagQName; + protected final QName metadataEtagQName; + protected final QName inlineQName; protected final QName actionQName; @@ -49,13 +51,28 @@ abstract class AbstractAtomDealer { protected final QName countQName; protected final QName uriQName; + protected final QName nextQName; + protected final QName contextQName; + + protected final QName entryRefQName; + + protected final QName v4PropertyValueQName; + + protected final QName errorCodeQName; + + protected final QName errorMessageQName; + + protected final QName errorTargetQName; + public AbstractAtomDealer(final ODataServiceVersion version) { this.version = version; this.etagQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ATTR_ETAG); + this.metadataEtagQName = + new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ATTR_METADATAETAG); this.inlineQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_INLINE); this.actionQName = @@ -64,14 +81,28 @@ 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 = - new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_ELEMENT); + this.elementQName = version == ODataServiceVersion.V30 + ? new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_ELEMENT) + : new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ELEM_ELEMENT); this.countQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_COUNT); this.uriQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_URI); this.nextQName = 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.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); + + 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 { @@ -83,5 +114,4 @@ abstract class AbstractAtomDealer { writer.writeNamespace(Constants.PREFIX_GML, Constants.NS_GML); writer.writeNamespace(Constants.PREFIX_GEORSS, Constants.NS_GEORSS); } - } 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 29a4a75f7..4c0f3468a 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 @@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.domain.ODataOperation; /** * Abstract base for classes implementing an OData entry in Atom and JSON. */ -public abstract class AbstractEntry extends AbstractAtomObject implements Entry { +public abstract class AbstractEntry extends AbstractODataObject implements Entry { private static final long serialVersionUID = 2127764552600969783L; @@ -55,6 +55,8 @@ public abstract class AbstractEntry extends AbstractAtomObject implements Entry private String mediaContentType; + private String mediaETag; + @Override public String getETag() { return eTag; @@ -152,6 +154,16 @@ public abstract class AbstractEntry extends AbstractAtomObject implements Entry this.mediaContentSource = mediaContentSource; } + @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); 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 4c92ae695..673125935 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 @@ -23,15 +23,15 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import java.util.Iterator; import java.util.Map; 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.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 extends ODataJacksonDeserializer { +abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer> { private JSONGeoValueDeserializer geoDeserializer; @@ -95,7 +95,7 @@ abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer { for (final Iterator> itor = node.fields(); itor.hasNext();) { final Map.Entry field = itor.next(); - if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) { + if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) { type = field.getValue().asText(); } else { final JSONPropertyImpl property = new JSONPropertyImpl(); @@ -122,10 +122,14 @@ abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer { final JsonNode child = nodeItor.next(); if (child.isValueNode()) { - value.get().add(fromPrimitive(child, type)); + if (typeInfo == null || typeInfo.isPrimitiveType()) { + value.get().add(fromPrimitive(child, type)); + } else { + value.get().add(new EnumValueImpl(child.asText())); + } } else if (child.isContainerNode()) { - if (child.has(Constants.JSON_TYPE)) { - ((ObjectNode) child).remove(Constants.JSON_TYPE); + if (child.has(jsonType)) { + ((ObjectNode) child).remove(jsonType); } value.get().add(fromComplex(child)); } @@ -145,6 +149,8 @@ abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer { ? ODataPropertyType.COLLECTION : typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE + : node.isValueNode() + ? ODataPropertyType.ENUM : ODataPropertyType.COMPLEX; switch (propType) { @@ -153,13 +159,17 @@ abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer { break; case COMPLEX: - if (node.has(Constants.JSON_TYPE)) { - property.setType(node.get(Constants.JSON_TYPE).asText()); - ((ObjectNode) node).remove(Constants.JSON_TYPE); + if (node.has(jsonType)) { + property.setType(node.get(jsonType).asText()); + ((ObjectNode) node).remove(jsonType); } property.setValue(fromComplex(node)); break; + case ENUM: + property.setValue(new EnumValueImpl(node.asText())); + break; + case PRIMITIVE: if (property.getType() == null) { property.setType(getPrimitiveType(node).getFullQualifiedName().toString()); 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 1380dd54d..dede6aaad 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 @@ -56,22 +56,24 @@ abstract class AbstractJsonSerializer extends ODataJacksonSerializer { if (value.isNull()) { jgen.writeNull(); - } else if (value.isSimple()) { + } else if (value.isPrimitive()) { final boolean isNumber = typeInfo == null - ? NumberUtils.isNumber(value.asSimple().get()) + ? NumberUtils.isNumber(value.asPrimitive().get()) : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveTypeKind()); final boolean isBoolean = typeInfo == null - ? (value.asSimple().get().equalsIgnoreCase(Boolean.TRUE.toString()) - || value.asSimple().get().equalsIgnoreCase(Boolean.FALSE.toString())) + ? (value.asPrimitive().get().equalsIgnoreCase(Boolean.TRUE.toString()) + || value.asPrimitive().get().equalsIgnoreCase(Boolean.FALSE.toString())) : typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Boolean; if (isNumber) { - jgen.writeNumber(value.asSimple().get()); + jgen.writeNumber(value.asPrimitive().get()); } else if (isBoolean) { - jgen.writeBoolean(BooleanUtils.toBoolean(value.asSimple().get())); + jgen.writeBoolean(BooleanUtils.toBoolean(value.asPrimitive().get())); } else { - jgen.writeString(value.asSimple().get()); + jgen.writeString(value.asPrimitive().get()); } + } else if (value.isEnum()) { + jgen.writeString(value.asEnum().get()); } else if (value.isGeospatial()) { jgen.writeStartObject(); geoSerializer.serialize(jgen, value.asGeospatial().get()); 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 000000000..e5324d816 --- /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; + } + +} diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java similarity index 94% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java index f09de400e..6dd86a28d 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java @@ -23,7 +23,7 @@ import java.net.URI; import java.text.ParseException; import java.util.Date; -abstract class AbstractAtomObject extends AbstractPayloadObject { +abstract class AbstractODataObject extends AbstractPayloadObject { private static final long serialVersionUID = -4391162864875546927L; @@ -51,6 +51,10 @@ abstract class AbstractAtomObject extends AbstractPayloadObject { return id; } + public void setId(final String id) { + this.id = id; + } + public String getTitle() { return title; } @@ -74,5 +78,4 @@ abstract class AbstractAtomObject extends AbstractPayloadObject { this.updated = ISO_DATEFORMAT.parse(value); } } - } 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/AbstractProperty.java similarity index 96% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java index e005f98fe..940bf8907 100644 --- 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/AbstractProperty.java @@ -25,7 +25,7 @@ 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 { +public abstract class AbstractProperty implements Property { private String name; 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 31629e2e9..629592fd4 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 @@ -24,6 +24,7 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; 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.NullValue; import org.apache.olingo.commons.api.data.PrimitiveValue; @@ -37,7 +38,7 @@ public abstract class AbstractValue implements Value { } @Override - public boolean isSimple() { + public boolean isPrimitive() { return false; } @@ -46,6 +47,11 @@ public abstract class AbstractValue implements Value { return false; } + @Override + public boolean isEnum() { + return false; + } + @Override public boolean isComplex() { return false; @@ -62,8 +68,8 @@ public abstract class AbstractValue implements Value { } @Override - public PrimitiveValue asSimple() { - return isSimple() ? (PrimitiveValue) this : null; + public PrimitiveValue asPrimitive() { + return isPrimitive() ? (PrimitiveValue) this : null; } @Override @@ -71,6 +77,11 @@ public abstract class AbstractValue implements Value { return isGeospatial() ? (GeospatialValue) this : null; } + @Override + public EnumValue asEnum() { + return isEnum() ? (EnumValue) this : null; + } + @Override public ComplexValue asComplex() { return isComplex() ? (ComplexValue) this : null; 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 b8775d5be..c748f599a 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 @@ -18,6 +18,7 @@ */ package org.apache.olingo.commons.core.data; +import org.apache.olingo.commons.api.data.Container; import java.io.InputStream; import java.net.URI; import java.text.ParseException; @@ -33,13 +34,9 @@ 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); - private static final XMLInputFactory FACTORY = XMLInputFactory.newInstance(); private final AtomPropertyDeserializer propDeserializer; @@ -49,9 +46,10 @@ public class AtomDeserializer extends AbstractAtomDealer { this.propDeserializer = new AtomPropertyDeserializer(version); } - private AtomPropertyImpl property(final InputStream input) throws XMLStreamException { + private Container property(final InputStream input) throws XMLStreamException { final XMLEventReader reader = FACTORY.createXMLEventReader(input); - return propDeserializer.deserialize(reader, skipBeforeFirstStartElement(reader)); + final StartElement start = skipBeforeFirstStartElement(reader); + return getContainer(start, propDeserializer.deserialize(reader, start)); } private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException { @@ -70,7 +68,7 @@ public class AtomDeserializer extends AbstractAtomDealer { } private void common(final XMLEventReader reader, final StartElement start, - final AbstractAtomObject object, final String key) throws XMLStreamException { + final AbstractODataObject object, final String key) throws XMLStreamException { boolean foundEndElement = false; while (reader.hasNext() && !foundEndElement) { @@ -123,8 +121,14 @@ public class AtomDeserializer extends AbstractAtomDealer { } } - private XMLLinkCollectionImpl linkCollection(final InputStream input) throws XMLStreamException { + private Container linkCollection(final InputStream input) throws XMLStreamException { final XMLEventReader reader = FACTORY.createXMLEventReader(input); + final StartElement start = skipBeforeFirstStartElement(reader); + return getContainer(start, linkCollection(reader, start)); + } + + private XMLLinkCollectionImpl linkCollection(final XMLEventReader reader, final StartElement start) + throws XMLStreamException { final XMLLinkCollectionImpl linkCollection = new XMLLinkCollectionImpl(); @@ -167,121 +171,146 @@ public class AtomDeserializer extends AbstractAtomDealer { } } - private AtomEntryImpl entry(final XMLEventReader reader, final StartElement start) throws XMLStreamException { - if (!Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) { - return null; - } - + private AtomEntryImpl entryRef(final StartElement start) throws XMLStreamException { final AtomEntryImpl entry = new AtomEntryImpl(); - final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE); - if (xmlBase != null) { - entry.setBaseURI(xmlBase.getValue()); - } - final Attribute etag = start.getAttributeByName(etagQName); - if (etag != null) { - entry.setETag(etag.getValue()); - } - boolean foundEndEntry = false; - while (reader.hasNext() && !foundEndEntry) { - final XMLEvent event = reader.nextEvent(); - - if (event.isStartElement()) { - if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) { - common(reader, event.asStartElement(), entry, "id"); - } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) { - common(reader, event.asStartElement(), entry, "title"); - } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) { - common(reader, event.asStartElement(), entry, "summary"); - } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) { - common(reader, event.asStartElement(), entry, "updated"); - } else if (Constants.QNAME_ATOM_ELEM_CATEGORY.equals(event.asStartElement().getName())) { - final Attribute term = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_TERM)); - if (term != null) { - entry.setType(term.getValue()); - } - } else 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 (Constants.SELF_LINK_REL.equals(link.getRel())) { - entry.setSelfLink(link); - } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) { - entry.setEditLink(link); - } else if (link.getRel().startsWith(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) { - entry.getNavigationLinks().add(link); - inline(reader, event.asStartElement(), link); - } else if (link.getRel().startsWith( - version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL))) { - - entry.getAssociationLinks().add(link); - } else if (link.getRel().startsWith( - version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL))) { - - final Attribute metag = event.asStartElement().getAttributeByName(etagQName); - if (metag != null) { - link.setMediaETag(metag.getValue()); - } - entry.getMediaEditLinks().add(link); - } - } else if (actionQName.equals(event.asStartElement().getName())) { - final ODataOperation operation = new ODataOperation(); - final Attribute metadata = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_METADATA)); - if (metadata != null) { - operation.setMetadataAnchor(metadata.getValue()); - } - final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE)); - if (title != null) { - operation.setTitle(title.getValue()); - } - final Attribute target = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TARGET)); - if (target != null) { - operation.setTarget(URI.create(target.getValue())); - } - - entry.getOperations().add(operation); - } else if (Constants.QNAME_ATOM_ELEM_CONTENT.equals(event.asStartElement().getName())) { - final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE)); - if (type == null || ContentType.APPLICATION_XML.equals(type.getValue())) { - properties(reader, skipBeforeFirstStartElement(reader), entry); - } else { - entry.setMediaContentType(type.getValue()); - final Attribute src = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_SRC)); - if (src != null) { - entry.setMediaContentSource(src.getValue()); - } - } - } else if (propertiesQName.equals(event.asStartElement().getName())) { - properties(reader, event.asStartElement(), entry); - } - } - - if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) { - foundEndEntry = true; - } + final Attribute entryRefId = start.getAttributeByName(Constants.QNAME_ATOM_ATTR_ID); + if (entryRefId != null) { + entry.setId(entryRefId.getValue()); } return entry; } - private AtomEntryImpl entry(final InputStream input) throws XMLStreamException { + private AtomEntryImpl entry(final XMLEventReader reader, final StartElement start) throws XMLStreamException { + final AtomEntryImpl entry; + if (entryRefQName.equals(start.getName())) { + entry = entryRef(start); + } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) { + entry = new AtomEntryImpl(); + final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE); + if (xmlBase != null) { + entry.setBaseURI(xmlBase.getValue()); + } + + final Attribute etag = start.getAttributeByName(etagQName); + if (etag != null) { + entry.setETag(etag.getValue()); + } + + boolean foundEndEntry = false; + while (reader.hasNext() && !foundEndEntry) { + final XMLEvent event = reader.nextEvent(); + + if (event.isStartElement()) { + if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) { + common(reader, event.asStartElement(), entry, "id"); + } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) { + common(reader, event.asStartElement(), entry, "title"); + } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) { + common(reader, event.asStartElement(), entry, "summary"); + } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) { + common(reader, event.asStartElement(), entry, "updated"); + } else if (Constants.QNAME_ATOM_ELEM_CATEGORY.equals(event.asStartElement().getName())) { + final Attribute term = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_TERM)); + if (term != null) { + entry.setType(term.getValue()); + } + } else 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 (Constants.SELF_LINK_REL.equals(link.getRel())) { + 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); + inline(reader, event.asStartElement(), link); + } else if (link.getRel().startsWith( + version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL))) { + + entry.getAssociationLinks().add(link); + } else if (link.getRel().startsWith( + version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL))) { + + final Attribute metag = event.asStartElement().getAttributeByName(etagQName); + if (metag != null) { + link.setMediaETag(metag.getValue()); + } + entry.getMediaEditLinks().add(link); + } + } else if (actionQName.equals(event.asStartElement().getName())) { + final ODataOperation operation = new ODataOperation(); + final Attribute metadata = + event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_METADATA)); + if (metadata != null) { + operation.setMetadataAnchor(metadata.getValue()); + } + final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE)); + if (title != null) { + operation.setTitle(title.getValue()); + } + final Attribute target = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TARGET)); + if (target != null) { + operation.setTarget(URI.create(target.getValue())); + } + + entry.getOperations().add(operation); + } else if (Constants.QNAME_ATOM_ELEM_CONTENT.equals(event.asStartElement().getName())) { + final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE)); + if (type == null || ContentType.APPLICATION_XML.equals(type.getValue())) { + properties(reader, skipBeforeFirstStartElement(reader), entry); + } else { + entry.setMediaContentType(type.getValue()); + final Attribute src = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_SRC)); + if (src != null) { + entry.setMediaContentSource(src.getValue()); + } + } + } else if (propertiesQName.equals(event.asStartElement().getName())) { + properties(reader, event.asStartElement(), entry); + } + } + + if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) { + foundEndEntry = true; + } + } + + return entry; + } else { + entry = null; + } + + return entry; + } + + private Container entry(final InputStream input) throws XMLStreamException { final XMLEventReader reader = FACTORY.createXMLEventReader(input); - return entry(reader, skipBeforeFirstStartElement(reader)); + final StartElement start = skipBeforeFirstStartElement(reader); + return getContainer(start, entry(reader, start)); } private void count(final XMLEventReader reader, final StartElement start, final AtomFeedImpl feed) @@ -305,7 +334,6 @@ public class AtomDeserializer extends AbstractAtomDealer { if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) { return null; } - final AtomFeedImpl feed = new AtomFeedImpl(); final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE); if (xmlBase != null) { @@ -336,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())); } } @@ -347,21 +377,92 @@ public class AtomDeserializer extends AbstractAtomDealer { return feed; } - private AtomFeedImpl feed(final InputStream input) throws XMLStreamException { + private Container feed(final InputStream input) throws XMLStreamException { final XMLEventReader reader = FACTORY.createXMLEventReader(input); - return feed(reader, skipBeforeFirstStartElement(reader)); + final StartElement start = skipBeforeFirstStartElement(reader); + 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 error(final InputStream input) throws XMLStreamException { + final XMLEventReader reader = FACTORY.createXMLEventReader(input); + final StartElement start = skipBeforeFirstStartElement(reader); + return getContainer(start, error(reader, start)); + } + + private Container getContainer(final StartElement start, final T object) { + final Attribute context = start.getAttributeByName(contextQName); + final Attribute metadataETag = start.getAttributeByName(metadataEtagQName); + + return new Container( + context == null ? null : URI.create(context.getValue()), + metadataETag == null ? null : metadataETag.getValue(), + object); } @SuppressWarnings("unchecked") - public T read(final InputStream input, final Class reference) throws XMLStreamException { - if (AtomFeedImpl.class.equals(reference)) { - return (T) feed(input); + public Container read(final InputStream input, final Class reference) + throws XMLStreamException { + + if (XMLODataErrorImpl.class.equals(reference)) { + return (Container) error(input); + } else if (AtomFeedImpl.class.equals(reference)) { + return (Container) feed(input); } else if (AtomEntryImpl.class.equals(reference)) { - return (T) entry(input); + return (Container) entry(input); } else if (AtomPropertyImpl.class.equals(reference)) { - return (T) property(input); + return (Container) property(input); } else if (XMLLinkCollectionImpl.class.equals(reference)) { - return (T) linkCollection(input); + return (Container) linkCollection(input); } return null; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java index d40f94529..09dfdcfe1 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java @@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.data.Feed; * * @see AtomEntry */ -public class AtomFeedImpl extends AbstractAtomObject implements Feed { +public class AtomFeedImpl extends AbstractODataObject implements Feed { private static final long serialVersionUID = 5466590540021319153L; diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java index 458e4cc76..0444fbab3 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java @@ -44,7 +44,7 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble; class AtomGeoValueDeserializer { private List points(final XMLEventReader reader, final StartElement start, - final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException { + final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException { final List result = new ArrayList(); @@ -55,7 +55,7 @@ class AtomGeoValueDeserializer { if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) { final String[] pointInfo = event.asCharacters().getData().split(" "); - final Point point = new Point(GeoUtils.getDimension(type), crs); + final Point point = new Point(GeoUtils.getDimension(type), srid); try { point.setX(EdmDouble.getInstance().valueOfString(pointInfo[0], null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class)); @@ -76,7 +76,7 @@ class AtomGeoValueDeserializer { } private MultiPoint multipoint(final XMLEventReader reader, final StartElement start, - final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException { + final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException { List points = Collections.emptyList(); @@ -93,17 +93,17 @@ class AtomGeoValueDeserializer { } } - return new MultiPoint(GeoUtils.getDimension(type), crs, points); + return new MultiPoint(GeoUtils.getDimension(type), srid, points); } private LineString lineString(final XMLEventReader reader, final StartElement start, - final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException { + final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException { - return new LineString(GeoUtils.getDimension(type), crs, points(reader, start, type, null)); + return new LineString(GeoUtils.getDimension(type), srid, points(reader, start, type, null)); } private Polygon polygon(final XMLEventReader reader, final StartElement start, - final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException { + final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException { List extPoints = null; List intPoints = null; @@ -126,11 +126,11 @@ class AtomGeoValueDeserializer { } } - return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints); + return new Polygon(GeoUtils.getDimension(type), srid, intPoints, extPoints); } private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start, - final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException { + final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException { final List lineStrings = new ArrayList(); @@ -147,11 +147,11 @@ class AtomGeoValueDeserializer { } } - return new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings); + return new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings); } private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start, - final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException { + final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException { final List polygons = new ArrayList(); @@ -168,11 +168,11 @@ class AtomGeoValueDeserializer { } } - return new MultiPolygon(GeoUtils.getDimension(type), crs, polygons); + return new MultiPolygon(GeoUtils.getDimension(type), srid, polygons); } private GeospatialCollection collection(final XMLEventReader reader, final StartElement start, - final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException { + final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException { final List geospatials = new ArrayList(); @@ -201,16 +201,16 @@ class AtomGeoValueDeserializer { } } - return new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials); + return new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials); } public Geospatial deserialize(final XMLEventReader reader, final StartElement start, final EdmPrimitiveTypeKind type) throws XMLStreamException { - String crs = null; + Integer srid = null; final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME); if (srsName != null) { - crs = StringUtils.substringAfterLast(srsName.getValue(), "/"); + srid = Integer.valueOf(StringUtils.substringAfterLast(srsName.getValue(), "/")); } Geospatial value; @@ -218,37 +218,37 @@ class AtomGeoValueDeserializer { switch (type) { case GeographyPoint: case GeometryPoint: - value = points(reader, start, type, crs).get(0); + value = points(reader, start, type, srid).get(0); break; case GeographyMultiPoint: case GeometryMultiPoint: - value = multipoint(reader, start, type, crs); + value = multipoint(reader, start, type, srid); break; case GeographyLineString: case GeometryLineString: - value = lineString(reader, start, type, crs); + value = lineString(reader, start, type, srid); break; case GeographyMultiLineString: case GeometryMultiLineString: - value = multiLineString(reader, start, type, crs); + value = multiLineString(reader, start, type, srid); break; case GeographyPolygon: case GeometryPolygon: - value = polygon(reader, start, type, crs); + value = polygon(reader, start, type, srid); break; case GeographyMultiPolygon: case GeometryMultiPolygon: - value = multiPolygon(reader, start, type, crs); + value = multiPolygon(reader, start, type, srid); break; case GeographyCollection: case GeometryCollection: - value = collection(reader, start, type, crs); + value = collection(reader, start, type, srid); break; default: diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java index 624bcfae4..d1636d4fa 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java @@ -118,9 +118,9 @@ class AtomGeoValueSerializer { } private void writeSrsName(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException { - if (value.getCrs() != null) { + if (value.getSrid() != null) { writer.writeAttribute(Constants.PREFIX_GML, Constants.NS_GML, Constants.ATTR_SRSNAME, - Constants.SRS_URLPREFIX + value.getCrs()); + Constants.SRS_URLPREFIX + value.getSrid()); } } 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 91ad49add..d9106a729 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 @@ -26,7 +26,6 @@ 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.ComplexValue; import org.apache.olingo.commons.api.data.Value; import org.apache.olingo.commons.api.domain.ODataPropertyType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; @@ -68,20 +67,27 @@ class AtomPropertyDeserializer extends AbstractAtomDealer { } } - return value; + return value == null ? new PrimitiveValueImpl(StringUtils.EMPTY) : value; } - private ComplexValue fromComplex(final XMLEventReader reader, final StartElement start) + private Value fromComplexOrEnum(final XMLEventReader reader, final StartElement start) throws XMLStreamException { - final ComplexValue value = new ComplexValueImpl(); + Value value = null; boolean foundEndProperty = false; while (reader.hasNext() && !foundEndProperty) { final XMLEvent event = reader.nextEvent(); if (event.isStartElement()) { - value.get().add(deserialize(reader, event.asStartElement())); + 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())) { @@ -106,9 +112,10 @@ class AtomPropertyDeserializer extends AbstractAtomDealer { final XMLEvent event = reader.nextEvent(); if (event.isStartElement()) { - switch (guessPropertyType(reader)) { + switch (guessPropertyType(reader, typeInfo)) { case COMPLEX: - value.get().add(fromComplex(reader, event.asStartElement())); + case ENUM: + value.get().add(fromComplexOrEnum(reader, event.asStartElement())); break; case PRIMITIVE: @@ -128,7 +135,9 @@ class AtomPropertyDeserializer extends AbstractAtomDealer { return value; } - private ODataPropertyType guessPropertyType(final XMLEventReader reader) throws XMLStreamException { + private ODataPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo) + throws XMLStreamException { + XMLEvent child = null; while (reader.hasNext() && child == null) { final XMLEvent event = reader.peek(); @@ -141,7 +150,9 @@ class AtomPropertyDeserializer extends AbstractAtomDealer { final ODataPropertyType type; if (child == null) { - type = ODataPropertyType.PRIMITIVE; + type = typeInfo == null || typeInfo.isPrimitiveType() + ? ODataPropertyType.PRIMITIVE + : ODataPropertyType.ENUM; } else { if (child.isStartElement()) { if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) { @@ -152,7 +163,9 @@ class AtomPropertyDeserializer extends AbstractAtomDealer { type = ODataPropertyType.COMPLEX; } } else if (child.isCharacters()) { - type = ODataPropertyType.PRIMITIVE; + type = typeInfo == null || typeInfo.isPrimitiveType() + ? ODataPropertyType.PRIMITIVE + : ODataPropertyType.ENUM; } else { type = ODataPropertyType.EMPTY; } @@ -165,15 +178,24 @@ class AtomPropertyDeserializer extends AbstractAtomDealer { throws XMLStreamException { final AtomPropertyImpl property = new AtomPropertyImpl(); - property.setName(start.getName().getLocalPart()); - final Attribute typeAttr = start.getAttributeByName(this.typeQName); + 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; - final Attribute nullAttr = start.getAttributeByName(this.nullQName); - final String typeAttrValue = typeAttr == null ? null : typeAttr.getValue(); - 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(); @@ -183,7 +205,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer { } final ODataPropertyType propType = typeInfo == null - ? guessPropertyType(reader) + ? guessPropertyType(reader, typeInfo) : typeInfo.isCollection() ? ODataPropertyType.COLLECTION : typeInfo.isPrimitiveType() @@ -196,7 +218,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer { break; case COMPLEX: - value = fromComplex(reader, start); + value = fromComplexOrEnum(reader, start); break; case PRIMITIVE: 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 9688db2d1..e0018bcd2 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; 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 index 8d2a8e1ea..0461ad2aa 100644 --- 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 @@ -26,6 +26,7 @@ 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 { @@ -38,16 +39,23 @@ class AtomPropertySerializer extends AbstractAtomDealer { private void collection(final XMLStreamWriter writer, final CollectionValue value) throws XMLStreamException { for (Value item : value.get()) { - writer.writeStartElement(Constants.PREFIX_DATASERVICES, Constants.ELEM_ELEMENT, - version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES)); + 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.isSimple()) { - writer.writeCharacters(value.asSimple().get()); + 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()) { @@ -62,14 +70,34 @@ class AtomPropertySerializer extends AbstractAtomDealer { public void property(final XMLStreamWriter writer, final Property property, final boolean standalone) throws XMLStreamException { - writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(), - version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES)); + 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, property.getType()); + Constants.ATTR_TYPE, type); } if (property.getValue().isNull()) { 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 4c6fb3a52..f89aaee17 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 @@ -104,7 +104,7 @@ public class AtomSerializer extends AbstractAtomDealer { } } - private void common(final XMLStreamWriter writer, final AbstractAtomObject object) throws XMLStreamException { + private void common(final XMLStreamWriter writer, final AbstractODataObject object) throws XMLStreamException { if (StringUtils.isNotBlank(object.getTitle())) { writer.writeStartElement(Constants.ATOM_ELEM_TITLE); writer.writeAttribute(Constants.ATTR_TYPE, TYPE_TEXT); @@ -142,8 +142,8 @@ public class AtomSerializer extends AbstractAtomDealer { writer.writeAttribute(Constants.ATOM_ATTR_TERM, entry.getType()); writer.writeEndElement(); - if (entry instanceof AbstractAtomObject) { - common(writer, (AbstractAtomObject) entry); + if (entry instanceof AbstractODataObject) { + common(writer, (AbstractODataObject) entry); } links(writer, entry.getAssociationLinks()); @@ -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)); - entry(writer, entry); + entryRef(writer, entry); + } else { + startDocument(writer, Constants.ATOM_ELEM_ENTRY); + + entry(writer, entry); + } writer.writeEndElement(); writer.writeEndDocument(); @@ -201,14 +214,19 @@ public class AtomSerializer extends AbstractAtomDealer { writer.writeEndElement(); } - if (feed instanceof AbstractAtomObject) { - common(writer, (AbstractAtomObject) feed); + if (feed instanceof AbstractODataObject) { + common(writer, (AbstractODataObject) feed); } 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) { 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/EnumValueImpl.java similarity index 59% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/EnumValueImpl.java index 433b7540a..5d79d2279 100644 --- 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/EnumValueImpl.java @@ -18,33 +18,24 @@ */ package org.apache.olingo.commons.core.data; -import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.olingo.commons.api.data.EnumValue; -/** - * This class represents a bundle for an OData error returned as JSON. - */ -public class JSONErrorBundle extends AbstractPayloadObject { +public class EnumValueImpl extends AbstractValue implements EnumValue { - private static final long serialVersionUID = -4784910226259754450L; + private final String value; - @JsonProperty("odata.error") - private JSONErrorImpl error; - - /** - * Gets error. - * - * @return OData error object. - */ - public JSONErrorImpl getError() { - return error; + public EnumValueImpl(final String value) { + this.value = value; } - /** - * Sets error. - * - * @param error OData error object. - */ - public void setError(final JSONErrorImpl error) { - this.error = error; + @Override + public boolean isEnum() { + return true; } + + @Override + public String get() { + return value; + } + } 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 3647fac5e..8abd3f3ad 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,19 +22,19 @@ 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.JsonMappingException; 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; -import java.text.ParseException; import java.util.HashSet; 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; @@ -60,7 +60,10 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer>readValueAs( + new TypeReference() { + }).getObject()); } if (inline instanceof ArrayNode) { @@ -69,7 +72,9 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer 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).>readValuesAs( + new TypeReference() { + }).next().getObject()); } link.setInlineFeed(feed); @@ -79,81 +84,96 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer doDeserialize(final JsonParser parser, final DeserializationContext ctxt) throws IOException, JsonProcessingException { final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser); - if (tree.has(Constants.JSON_VALUE) && tree.get(Constants.JSON_VALUE).isArray()) { + if (tree.has(Constants.VALUE) && tree.get(Constants.VALUE).isArray()) { throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation()); } + final String metadataETag; + final URI contextURL; final JSONEntryImpl entry = new JSONEntryImpl(); - if (tree.hasNonNull(Constants.JSON_METADATA)) { - entry.setMetadata(URI.create(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)) { + 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; } - if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) { - entry.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue()); - tree.remove(Constants.JSON_MEDIA_ETAG); + if (contextURL != null) { + String url = contextURL.toASCIIString(); + entry.setBaseURI(url.substring(0, url.indexOf(Constants.METADATA))); } - 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(Constants.JSON_TYPE)) { - entry.setType(tree.get(Constants.JSON_TYPE).textValue()); - tree.remove(Constants.JSON_TYPE); + if (tree.hasNonNull(jsonType)) { + entry.setType(tree.get(jsonType).textValue()); + tree.remove(jsonType); } - if (tree.hasNonNull(Constants.JSON_ID)) { - try { - entry.setId(tree.get(Constants.JSON_ID).textValue()); - } catch (ParseException e) { - throw new JsonMappingException("While parsing Atom entry or feed common elements", e); - } - tree.remove(Constants.JSON_ID); + if (tree.hasNonNull(jsonId)) { + entry.setId(tree.get(jsonId).textValue()); + tree.remove(jsonId); } - if (tree.hasNonNull(Constants.JSON_READ_LINK)) { + if (tree.hasNonNull(jsonReadLink)) { final LinkImpl link = new LinkImpl(); link.setRel(Constants.SELF_LINK_REL); - link.setHref(tree.get(Constants.JSON_READ_LINK).textValue()); + link.setHref(tree.get(jsonReadLink).textValue()); entry.setSelfLink(link); - tree.remove(Constants.JSON_READ_LINK); + tree.remove(jsonReadLink); } - if (tree.hasNonNull(Constants.JSON_EDIT_LINK)) { + if (tree.hasNonNull(jsonEditLink)) { final LinkImpl link = new LinkImpl(); link.setRel(Constants.EDIT_LINK_REL); - link.setHref(tree.get(Constants.JSON_EDIT_LINK).textValue()); + link.setHref(tree.get(jsonEditLink).textValue()); entry.setEditLink(link); - tree.remove(Constants.JSON_EDIT_LINK); + tree.remove(jsonEditLink); } - if (tree.hasNonNull(Constants.JSON_MEDIAREAD_LINK)) { - entry.setMediaContentSource(tree.get(Constants.JSON_MEDIAREAD_LINK).textValue()); - tree.remove(Constants.JSON_MEDIAREAD_LINK); + if (tree.hasNonNull(jsonMediaReadLink)) { + entry.setMediaContentSource(tree.get(jsonMediaReadLink).textValue()); + tree.remove(jsonMediaReadLink); } - if (tree.hasNonNull(Constants.JSON_MEDIAEDIT_LINK)) { - tree.remove(Constants.JSON_MEDIAEDIT_LINK); + 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 toRemove = new HashSet(); for (final Iterator> itor = tree.fields(); itor.hasNext();) { final Map.Entry field = itor.next(); - if (field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK_SUFFIX)) { + 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)); @@ -171,8 +191,8 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer> itor = tree.fields(); itor.hasNext();) { final Map.Entry field = itor.next(); - if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) { + if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) { type = field.getValue().asText(); } else { final JSONPropertyImpl property = new JSONPropertyImpl(); @@ -236,6 +256,6 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer(contextURL, metadataETag, entry); } } 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 765c18a20..edf4366a9 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 @@ -20,9 +20,6 @@ package org.apache.olingo.commons.core.data; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.net.URI; -import java.text.ParseException; -import org.apache.olingo.commons.api.Constants; /** * A single entry, represented via JSON. @@ -33,60 +30,4 @@ public class JSONEntryImpl extends AbstractEntry { private static final long serialVersionUID = -5275365545400797758L; - private URI metadata; - - private String mediaETag; - - public void setId(final String id) throws ParseException { - this.setCommonProperty("id", id); - } - - @Override - public URI getBaseURI() { - URI baseURI = null; - if (metadata != null) { - final String metadataURI = getMetadata().toASCIIString(); - baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA))); - } - - return baseURI; - } - - /** - * Gets the metadata URI. - * - * @return the metadata URI - */ - public URI getMetadata() { - return metadata; - } - - /** - * Sets the metadata URI. - * - * @param metadata metadata URI. - */ - public void setMetadata(final URI metadata) { - this.metadata = metadata; - } - - /** - * 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; - } } 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 404174811..eb51362c8 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 @@ -32,6 +32,7 @@ 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; /** * Writes out JSON string from an entry. @@ -44,11 +45,8 @@ public class JSONEntrySerializer extends AbstractJsonSerializer { jgen.writeStartObject(); - if (entry.getMetadata() != null) { - jgen.writeStringField(Constants.JSON_METADATA, entry.getMetadata().toASCIIString()); - } if (entry.getId() != null) { - jgen.writeStringField(Constants.JSON_ID, entry.getId()); + jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), entry.getId()); } final Map> entitySetLinks = new HashMap>(); @@ -96,7 +94,7 @@ public class JSONEntrySerializer extends AbstractJsonSerializer { for (Link link : entry.getMediaEditLinks()) { if (link.getTitle() == null) { - jgen.writeStringField(Constants.JSON_MEDIAEDIT_LINK, link.getHref()); + jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK), link.getHref()); } if (link.getInlineEntry() != null) { 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 4c6cb4a44..000000000 --- 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(); - } -} 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 81a8d473b..3c180b91b 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,20 +38,38 @@ import org.apache.olingo.commons.api.Constants; public class JSONFeedDeserializer extends AbstractJsonDeserializer { @Override - protected JSONFeedImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt) + protected Container doDeserialize(final JsonParser parser, final DeserializationContext ctxt) throws IOException, JsonProcessingException { final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser); - if (!tree.has(Constants.JSON_VALUE)) { + if (!tree.has(Constants.VALUE)) { return null; } + final String metadataETag; + final URI contextURL; final JSONFeedImpl feed = new JSONFeedImpl(); - if (tree.hasNonNull(Constants.JSON_METADATA)) { - feed.setMetadata(URI.create(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)) { + 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; + } + + feed.setMetadataContextURL(contextURL); + if (tree.hasNonNull(Constants.JSON_COUNT)) { feed.setCount(tree.get(Constants.JSON_COUNT).asInt()); } @@ -57,12 +77,15 @@ public class JSONFeedDeserializer extends AbstractJsonDeserializer feed.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue())); } - if (tree.hasNonNull(Constants.JSON_VALUE)) { - for (final Iterator itor = tree.get(Constants.JSON_VALUE).iterator(); itor.hasNext();) { - feed.getEntries().add(itor.next().traverse(parser.getCodec()).readValueAs(JSONEntryImpl.class)); + if (tree.hasNonNull(Constants.VALUE)) { + for (final Iterator itor = tree.get(Constants.VALUE).iterator(); itor.hasNext();) { + feed.getEntries().add( + itor.next().traverse(parser.getCodec()).>readValueAs( + new TypeReference() { + }).getObject()); } } - return feed; + return new Container(contextURL, metadataETag, feed); } } 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 f41e21c24..0a4db73ed 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,9 +38,9 @@ public class JSONFeedImpl extends AbstractPayloadObject implements Feed { private static final long serialVersionUID = -3576372289800799417L; - private String id; + private URI metadataContextURL; - private URI metadata; + private String id; private Integer count; @@ -51,30 +51,16 @@ public class JSONFeedImpl extends AbstractPayloadObject implements Feed { @Override public URI getBaseURI() { URI baseURI = null; - if (metadata != null) { - final String metadataURI = getMetadata().toASCIIString(); + if (metadataContextURL != null) { + final String metadataURI = metadataContextURL.toASCIIString(); baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA))); } return baseURI; } - /** - * Gets the metadata URI. - * - * @return the metadata URI - */ - public URI getMetadata() { - return metadata; - } - - /** - * Sets the metadata URI. - * - * @param metadata metadata URI. - */ - public void setMetadata(final URI metadata) { - this.metadata = metadata; + public void setMetadataContextURL(final URI metadataContextURL) { + this.metadataContextURL = metadataContextURL; } @Override diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java index 25a735858..649bc990c 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java @@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.SerializerProvider; import java.io.IOException; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.Entry; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; public class JSONFeedSerializer extends AbstractJsonSerializer { @@ -33,11 +34,8 @@ public class JSONFeedSerializer extends AbstractJsonSerializer { jgen.writeStartObject(); - if (feed.getMetadata() != null) { - jgen.writeStringField(Constants.JSON_METADATA, feed.getMetadata().toASCIIString()); - } if (feed.getId() != null) { - jgen.writeStringField(Constants.JSON_ID, feed.getId()); + jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), feed.getId()); } if (feed.getCount() != null) { jgen.writeNumberField(Constants.JSON_COUNT, feed.getCount()); @@ -46,12 +44,11 @@ public class JSONFeedSerializer extends AbstractJsonSerializer { jgen.writeStringField(Constants.JSON_NEXT_LINK, feed.getNext().toASCIIString()); } - jgen.writeArrayFieldStart(Constants.JSON_VALUE); + jgen.writeArrayFieldStart(Constants.VALUE); for (Entry entry : feed.getEntries()) { jgen.writeObject(entry); } jgen.writeEndArray(); } - } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java index c544f739d..09ecbdf51 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java @@ -47,11 +47,11 @@ class JSONGeoValueDeserializer { this.version = version; } - private Point point(final Iterator itor, final EdmPrimitiveTypeKind type, final String crs) { + private Point point(final Iterator itor, final EdmPrimitiveTypeKind type, final Integer srid) { Point point = null; if (itor.hasNext()) { - point = new Point(GeoUtils.getDimension(type), crs); + point = new Point(GeoUtils.getDimension(type), srid); try { point.setX(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class)); @@ -65,46 +65,42 @@ class JSONGeoValueDeserializer { return point; } - private MultiPoint multipoint(final Iterator itor, final EdmPrimitiveTypeKind type, - final String crs) { - + private MultiPoint multipoint(final Iterator itor, final EdmPrimitiveTypeKind type, final Integer srid) { final MultiPoint multiPoint; if (itor.hasNext()) { final List points = new ArrayList(); while (itor.hasNext()) { final Iterator mpItor = itor.next().elements(); - points.add(point(mpItor, type, crs)); + points.add(point(mpItor, type, srid)); } - multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, points); + multiPoint = new MultiPoint(GeoUtils.getDimension(type), srid, points); } else { - multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, Collections.emptyList()); + multiPoint = new MultiPoint(GeoUtils.getDimension(type), srid, Collections.emptyList()); } return multiPoint; } - private LineString lineString(final Iterator itor, final EdmPrimitiveTypeKind type, - final String crs) { - + private LineString lineString(final Iterator itor, final EdmPrimitiveTypeKind type, final Integer srid) { final LineString lineString; if (itor.hasNext()) { final List points = new ArrayList(); while (itor.hasNext()) { final Iterator mpItor = itor.next().elements(); - points.add(point(mpItor, type, crs)); + points.add(point(mpItor, type, srid)); } - lineString = new LineString(GeoUtils.getDimension(type), crs, points); + lineString = new LineString(GeoUtils.getDimension(type), srid, points); } else { - lineString = new LineString(GeoUtils.getDimension(type), crs, Collections.emptyList()); + lineString = new LineString(GeoUtils.getDimension(type), srid, Collections.emptyList()); } return lineString; } private MultiLineString multiLineString(final Iterator itor, final EdmPrimitiveTypeKind type, - final String crs) { + final Integer srid) { final MultiLineString multiLineString; @@ -112,18 +108,18 @@ class JSONGeoValueDeserializer { final List lineStrings = new ArrayList(); while (itor.hasNext()) { final Iterator mlsItor = itor.next().elements(); - lineStrings.add(lineString(mlsItor, type, crs)); + lineStrings.add(lineString(mlsItor, type, srid)); } - multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings); + multiLineString = new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings); } else { - multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, Collections.emptyList()); + multiLineString = new MultiLineString(GeoUtils.getDimension(type), srid, Collections.emptyList()); } return multiLineString; } private Polygon polygon(final Iterator itor, final EdmPrimitiveTypeKind type, - final String crs) { + final Integer srid) { List extPoints = null; if (itor.hasNext()) { @@ -132,7 +128,7 @@ class JSONGeoValueDeserializer { extPoints = new ArrayList(); while (extItor.hasNext()) { final Iterator mpItor = extItor.next().elements(); - extPoints.add(point(mpItor, type, crs)); + extPoints.add(point(mpItor, type, srid)); } } } @@ -144,16 +140,16 @@ class JSONGeoValueDeserializer { intPoints = new ArrayList(); while (intItor.hasNext()) { final Iterator mpItor = intItor.next().elements(); - intPoints.add(point(mpItor, type, crs)); + intPoints.add(point(mpItor, type, srid)); } } } - return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints); + return new Polygon(GeoUtils.getDimension(type), srid, intPoints, extPoints); } private MultiPolygon multiPolygon(final Iterator itor, final EdmPrimitiveTypeKind type, - final String crs) { + final Integer srid) { final MultiPolygon multiPolygon; @@ -161,18 +157,18 @@ class JSONGeoValueDeserializer { final List polygons = new ArrayList(); while (itor.hasNext()) { final Iterator mpItor = itor.next().elements(); - polygons.add(polygon(mpItor, type, crs)); + polygons.add(polygon(mpItor, type, srid)); } - multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, polygons); + multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), srid, polygons); } else { - multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, Collections.emptyList()); + multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), srid, Collections.emptyList()); } return multiPolygon; } private GeospatialCollection collection(final Iterator itor, final EdmPrimitiveTypeKind type, - final String crs) { + final Integer srid) { final GeospatialCollection collection; @@ -195,9 +191,9 @@ class JSONGeoValueDeserializer { geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build())); } - collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials); + collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials); } else { - collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, Collections.emptyList()); + collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, Collections.emptyList()); } return collection; @@ -223,46 +219,47 @@ class JSONGeoValueDeserializer { ? node.get(Constants.JSON_COORDINATES).elements() : Collections.emptyList().iterator(); - String crs = null; + Integer srid = null; if (node.has(Constants.JSON_CRS)) { - crs = node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1]; + srid = Integer.valueOf( + node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1]); } Geospatial value = null; switch (actualType) { case GeographyPoint: case GeometryPoint: - value = point(cooItor, actualType, crs); + value = point(cooItor, actualType, srid); break; case GeographyMultiPoint: case GeometryMultiPoint: - value = multipoint(cooItor, actualType, crs); + value = multipoint(cooItor, actualType, srid); break; case GeographyLineString: case GeometryLineString: - value = lineString(cooItor, actualType, crs); + value = lineString(cooItor, actualType, srid); break; case GeographyMultiLineString: case GeometryMultiLineString: - value = multiLineString(cooItor, actualType, crs); + value = multiLineString(cooItor, actualType, srid); break; case GeographyPolygon: case GeometryPolygon: - value = polygon(cooItor, actualType, crs); + value = polygon(cooItor, actualType, srid); break; case GeographyMultiPolygon: case GeometryMultiPolygon: - value = multiPolygon(cooItor, actualType, crs); + value = multiPolygon(cooItor, actualType, srid); break; case GeographyCollection: case GeometryCollection: - value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs); + value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, srid); break; default: diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java index 95c30d49d..470872e35 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java @@ -37,11 +37,11 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble; class JSONGeoValueSerializer { - private void crs(final JsonGenerator jgen, final String crs) throws IOException { + private void srid(final JsonGenerator jgen, final Integer srid) throws IOException { jgen.writeObjectFieldStart(Constants.JSON_CRS); jgen.writeStringField(Constants.ATTR_TYPE, Constants.JSON_NAME); jgen.writeObjectFieldStart(Constants.PROPERTIES); - jgen.writeStringField(Constants.JSON_NAME, "EPSG:" + crs); + jgen.writeStringField(Constants.JSON_NAME, "EPSG:" + srid); jgen.writeEndObject(); jgen.writeEndObject(); } @@ -175,8 +175,8 @@ class JSONGeoValueSerializer { default: } - if (value.getCrs() != null) { - crs(jgen, value.getCrs()); + if (value.getSrid() != null) { + srid(jgen, value.getSrid()); } } 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 000000000..de3ffa113 --- /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; +import org.apache.olingo.commons.api.data.Container; + +public class JSONODataErrorDeserializer extends AbstractJsonDeserializer { + + @Override + protected Container 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 new Container(null, null, error); + } +} 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 000000000..c455d2d47 --- /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 { + +} 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 b68d99856..381b6d4c9 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 @@ -24,7 +24,9 @@ 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 JSONPropertyImpl. @@ -34,28 +36,36 @@ import org.apache.olingo.commons.api.Constants; public class JSONPropertyDeserializer extends AbstractJsonDeserializer { @Override - protected JSONPropertyImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt) + protected Container 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)) { - property.setMetadata(URI.create(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)) { + 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)) { + contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue()); + property.setType(StringUtils.substringAfterLast(contextURL.toASCIIString(), "#")); tree.remove(Constants.JSON_METADATA); + } else { + contextURL = null; } - if (property.getMetadata() != null) { - final String metadataURI = property.getMetadata().toASCIIString(); - final int dashIdx = metadataURI.lastIndexOf('#'); - if (dashIdx != -1) { - property.setType(metadataURI.substring(dashIdx + 1)); - } - } - - if (tree.has(Constants.JSON_TYPE) && property.getType() == null) { - property.setType(tree.get(Constants.JSON_TYPE).asText()); + if (tree.has(jsonType)) { + property.setType(tree.get(jsonType).asText()); } if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) { @@ -63,9 +73,9 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer(contextURL, metadataETag, property); } } 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 027eac33e..101866605 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 @@ -20,34 +20,14 @@ package org.apache.olingo.commons.core.data; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.net.URI; /** * A single property (primitive, complex or collection) represented via JSON. */ @JsonSerialize(using = JSONPropertySerializer.class) @JsonDeserialize(using = JSONPropertyDeserializer.class) -public class JSONPropertyImpl extends AbstractPropertyImpl { +public class JSONPropertyImpl extends AbstractProperty { private static final long serialVersionUID = 553414431536637434L; - private URI metadata; - - /** - * Gets metadata URI. - * - * @return metadata URI. - */ - public URI getMetadata() { - return metadata; - } - - /** - * Sets metadata URI. - * - * @param metadata metadata URI. - */ - public void setMetadata(final URI metadata) { - this.metadata = metadata; - } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java index 104083bc3..d1804eb88 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java @@ -38,16 +38,14 @@ public class JSONPropertySerializer extends AbstractJsonSerializer extends JsonDeserializer { protected ODataServiceVersion version; + protected String jsonType; + + protected String jsonId; + + protected String jsonETag; + + protected String jsonReadLink; + + protected String jsonEditLink; + + protected String jsonMediaEditLink; + + protected String jsonMediaReadLink; + + protected String jsonMediaContentType; + + protected String jsonMediaETag; + + protected String jsonAssociationLink; + + protected String jsonNavigationLink; + + protected String jsonError; + protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException; + protected String getJSONAnnotation(final String string) { + return string.startsWith("@") ? string : "@" + string; + } + @Override public T deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { version = (ODataServiceVersion) ctxt.findInjectableValue(ODataServiceVersion.class.getName(), null, null); + + 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); + jsonError = version.getJSONMap().get(ODataServiceVersion.JSON_ERROR); + return doDeserialize(jp, ctxt); } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java index 2d0a6bc0c..b3334ae33 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java @@ -29,7 +29,7 @@ public class PrimitiveValueImpl extends AbstractValue implements PrimitiveValue } @Override - public boolean isSimple() { + public boolean isPrimitive() { return true; } 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 a8c3d84d3..000000000 --- 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 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 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; - } - } -} 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 000000000..36cb68275 --- /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 { + +} 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 000000000..2f8236b04 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java @@ -0,0 +1,92 @@ +/* + * 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 The actual ODataValue interface. + */ +public abstract class AbstractODataCollectionValue + extends AbstractODataValue implements ODataCollectionValue { + + private static final long serialVersionUID = -3665659846001987187L; + + /** + * Values. + */ + private final List values = new ArrayList(); + + /** + * 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 + @SuppressWarnings("unchecked") + public void add(final ODataValue value) { + values.add((OV) value); + } + + /** + * Value iterator. + * + * @return value iterator. + */ + @Override + public Iterator 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(); + } +} 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 000000000..6a0966454 --- /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 The actual ODataProperty interface. + */ +public abstract class AbstractODataComplexValue + extends AbstractODataValue implements ODataComplexValue { + + private static final long serialVersionUID = -1878555027714020431L; + + /** + * Complex type fields. + */ + private final Map fields = new LinkedHashMap(); + + /** + * 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 iterator() { + return fields.values().iterator(); + } + + /** + * Gets number of fields. + * + * @return number of fields. + */ + @Override + public int size() { + return fields.size(); + } +} diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java similarity index 58% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java index 6f84e4bf7..06b525c37 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java @@ -16,17 +16,22 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.commons.api.domain; +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 class ODataEntity extends ODataItem implements ODataInvokeResult { +public abstract class AbstractODataEntity extends AbstractODataPayload implements CommonODataEntity { private static final long serialVersionUID = 8360640095932811034L; @@ -50,69 +55,51 @@ public class ODataEntity extends ODataItem implements ODataInvokeResult { */ private String mediaContentSource; + /** + * Media ETag. + */ + private String mediaETag; + /** * Edit link. */ - protected URI editLink; + private URI editLink; /** * Navigation links (might contain in-line entities or feeds). */ - protected final List navigationLinks = new ArrayList(); + private final List navigationLinks = new ArrayList(); /** * Association links. */ - protected final List associationLinks = new ArrayList(); + private final List associationLinks = new ArrayList(); /** * Media edit links. */ - protected final List editMediaLinks = new ArrayList(); + private final List editMediaLinks = new ArrayList(); /** * Operations (legacy, functions, actions). */ - protected final List operations = new ArrayList(); + private final List operations = new ArrayList(); - /** - * Entity properties. - */ - protected final List properties = new ArrayList(); - - /** - * Constructor. - * - * @param name OData entity name. - */ - public ODataEntity(final String 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, null otherwise - */ + @Override public ODataOperation getOperation(final String title) { ODataOperation result = null; for (ODataOperation operation : operations) { @@ -129,21 +116,17 @@ public class ODataEntity extends ODataItem implements ODataInvokeResult { * * @return operations. */ + @Override public List getOperations() { return this.operations; } - /** - * Searches for property with given name. - * - * @param name property to look for - * @return property if found with given name, null otherwise - */ - public ODataProperty getProperty(final String name) { - ODataProperty result = null; + @Override + public CommonODataProperty getProperty(final String name) { + CommonODataProperty result = null; if (StringUtils.isNotBlank(name)) { - for (ODataProperty property : properties) { + for (CommonODataProperty property : getProperties()) { if (name.equals(property.getName())) { result = property; } @@ -153,21 +136,7 @@ public class ODataEntity extends ODataItem implements ODataInvokeResult { return result; } - /** - * Returns OData entity properties. - * - * @return OData entity properties. - */ - public List getProperties() { - return properties; - } - - /** - * Puts the given link into one of available lists, based on its type. - * - * @param link to be added - * @return true if the given link was added in one of available lists - */ + @Override public boolean addLink(final ODataLink link) { boolean result = false; @@ -191,57 +160,58 @@ public class ODataEntity extends ODataItem implements ODataInvokeResult { return result; } - /** - * Removes the given link from any list (association, navigation, edit-media). - * - * @param link to be removed - * @return true 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 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 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 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 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; } @@ -251,66 +221,48 @@ public class ODataEntity extends ODataItem implements ODataInvokeResult { 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; + } } 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 000000000..b2f7dc8bb --- /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 $inlinecount 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; + } +} 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/domain/AbstractODataObjectFactory.java similarity index 65% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java index 5e9f9c1d3..43853fa1e 100644 --- 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/domain/AbstractODataObjectFactory.java @@ -16,77 +16,50 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.commons.core.op; +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.ODataGeospatialValue; +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.ODataObjectFactory; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.CommonODataObjectFactory; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -public class ODataObjectFactoryImpl implements ODataObjectFactory { +public abstract class AbstractODataObjectFactory implements CommonODataObjectFactory { private static final long serialVersionUID = -3769695665946919447L; protected final ODataServiceVersion version; - public ODataObjectFactoryImpl(final ODataServiceVersion version) { + public AbstractODataObjectFactory(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) { + 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 ODataEntitySet entitySet) { + 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 ODataEntity entity) { + 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 ODataEntity entity) { + final CommonODataEntity entity) { return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity); } @@ -104,13 +77,13 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory { } @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(); } @@ -139,24 +112,4 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory { 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 newPrimitiveProperty(final String name, final ODataGeospatialValue 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); - } - } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java similarity index 61% rename from lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java index a15dd7683..9d2d6ec10 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java @@ -16,12 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.client.core.domain; +package org.apache.olingo.commons.core.domain; import java.sql.Timestamp; import java.util.Calendar; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.domain.AbstractODataValue; import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; @@ -31,23 +29,22 @@ 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 { +public abstract class AbstractODataPrimitiveValue extends AbstractODataValue implements ODataPrimitiveValue { private static final long serialVersionUID = 8889282662298376036L; - public static class BuilderImpl implements Builder { + public static abstract class AbstractBuilder implements Builder { private final ODataServiceVersion version; - private final ODataPrimitiveValueImpl instance; - - public BuilderImpl(final ODataServiceVersion version) { + public AbstractBuilder(final ODataServiceVersion version) { this.version = version; - this.instance = new ODataPrimitiveValueImpl(); } + protected abstract AbstractODataPrimitiveValue getInstance(); + @Override - public BuilderImpl setType(final EdmPrimitiveTypeKind type) { + 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)); @@ -56,64 +53,68 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData throw new IllegalArgumentException(String.format( "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString())); } - if (type != null && type.isGeospatial()) { - throw new IllegalArgumentException("Don't use this for geospatial types"); + 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.getNonGeoInstance(this.instance.typeKind); + getInstance().typeKind = type == null ? EdmPrimitiveTypeKind.String : type; + getInstance().type = EdmPrimitiveTypeFactory.getInstance(getInstance().typeKind); return this; } @Override - public BuilderImpl setText(final String text) { - this.instance.text = text; + public AbstractBuilder setText(final String text) { + getInstance().text = text; return this; } @Override - public BuilderImpl setValue(final Object value) { - this.instance.value = value; + public AbstractBuilder setValue(final Object value) { + getInstance().value = value; return this; } @Override - public ODataPrimitiveValueImpl build() { - if (this.instance.text == null && this.instance.value == null) { + public AbstractODataPrimitiveValue build() { + if (getInstance().text == null && getInstance().value == null) { throw new IllegalArgumentException("Must provide either text or value"); } - if (this.instance.text != null && this.instance.value != null) { + if (getInstance().text != null && getInstance().value != null) { throw new IllegalArgumentException("Cannot provide both text and value"); } - if (this.instance.type == null) { + if (getInstance().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(); + 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 - this.instance.value = this.instance.type.valueOfString( - this.instance.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, + 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 (this.instance.value != null) { + if (getInstance().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); + getInstance().text = getInstance().type.valueToString( + getInstance().value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null); } catch (EdmPrimitiveTypeException e) { throw new IllegalArgumentException(e); } } - return this.instance; + return getInstance(); } } @@ -137,6 +138,15 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData */ private Object value; + protected AbstractODataPrimitiveValue() { + super(null); + } + + @Override + public String getTypeName() { + return typeKind.getFullQualifiedName().toString(); + } + @Override public EdmPrimitiveTypeKind getTypeKind() { return typeKind; @@ -154,9 +164,11 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData @Override public T toCastValue(final Class reference) throws EdmPrimitiveTypeException { - // TODO: when Edm is available, set facets when calling this method - return type.valueOfString(this.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, - reference); + 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 @@ -164,14 +176,4 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData return this.text; } - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public boolean equals(final Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java similarity index 69% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java index 721728286..532303cb5 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java @@ -16,18 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.commons.api.domain; +package org.apache.olingo.commons.core.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; +import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.CommonODataProperty; +import org.apache.olingo.commons.api.domain.ODataValue; -/** - * OData entity property. - */ -public class ODataProperty implements Serializable, ODataInvokeResult { +public abstract class AbstractODataProperty implements CommonODataProperty { private static final long serialVersionUID = 926939448778950450L; @@ -39,7 +38,7 @@ public class ODataProperty implements Serializable, ODataInvokeResult { /** * Property value. */ - private ODataValue value; + private final ODataValue value; /** * Constructor. @@ -47,7 +46,7 @@ public class ODataProperty implements Serializable, ODataInvokeResult { * @param name property name. * @param value property value. */ - public ODataProperty(final String name, final ODataValue value) { + public AbstractODataProperty(final String name, final ODataValue value) { this.name = name; this.value = value; } @@ -57,6 +56,7 @@ public class ODataProperty implements Serializable, ODataInvokeResult { * * @return property name. */ + @Override public String getName() { return name; } @@ -66,24 +66,17 @@ public class ODataProperty implements Serializable, ODataInvokeResult { * * @return property value. */ + @Override public ODataValue getValue() { return value; } - /** - * Updates property value. - * - * @param value property value that replaces current. - */ - public void setValue(final ODataValue value) { - this.value = value; - } - /** * Checks if has null value. * * @return 'TRUE' if has null value; 'FALSE' otherwise. */ + @Override public boolean hasNullValue() { return this.value == null; } @@ -93,6 +86,7 @@ public class ODataProperty implements Serializable, ODataInvokeResult { * * @return 'TRUE' if has primitive value; 'FALSE' otherwise. */ + @Override public boolean hasPrimitiveValue() { return !hasNullValue() && this.value.isPrimitive(); } @@ -102,64 +96,31 @@ public class ODataProperty implements Serializable, ODataInvokeResult { * * @return primitive value if exists; null otherwise. */ + @Override public ODataPrimitiveValue getPrimitiveValue() { return hasPrimitiveValue() ? this.value.asPrimitive() : null; } - /** - * Checks if has geospatial value. - * - * @return 'TRUE' if has geospatial value; 'FALSE' otherwise. - */ - public boolean hasGeospatialValue() { - return !hasNullValue() && this.value.isGeospatial(); - } - - /** - * Gets geospatial value. - * - * @return geospatial value if exists; null otherwise. - */ - public ODataGeospatialValue getGeospatialValue() { - return hasGeospatialValue() ? this.value.asGeospatial() : 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. - */ - 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. - */ - public ODataCollectionValue getCollectionValue() { - return hasCollectionValue() ? this.value.asCollection() : null; - } - /** * {@inheritDoc } */ 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 000000000..1ebd62a81 --- /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 { + + private static final long serialVersionUID = 5887168245885401351L; + + public ODataCollectionValueImpl(final String typeName) { + super(typeName); + } + +} 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 000000000..4b09fccd3 --- /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 { + + private static final long serialVersionUID = 1143925901934898802L; + + public ODataComplexValueImpl(final String typeName) { + super(typeName); + } + +} 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 000000000..8a41e7ac8 --- /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 properties = new ArrayList(); + + public ODataEntityImpl(final String name) { + super(name); + } + + @Override + public ODataProperty getProperty(final String name) { + return (ODataProperty) super.getProperty(name); + } + + @Override + public List getProperties() { + return properties; + } +} 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 000000000..83870f3fe --- /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 entities = new ArrayList(); + + public ODataEntitySetImpl() { + } + + public ODataEntitySetImpl(final URI next) { + super(next); + } + + @Override + protected int getEntitiesSize() { + return entities.size(); + } + + @Override + public List getEntities() { + return entities; + } + +} 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 000000000..18f9e1386 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java @@ -0,0 +1,96 @@ +/* + * 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.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; +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 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); + } + +} 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 000000000..6dc3034d4 --- /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; + } + + } + +} 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 000000000..45eb01f62 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java @@ -0,0 +1,45 @@ +/* + * 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.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; + +public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty { + + private static final long serialVersionUID = 4851331227420757747L; + + public ODataPropertyImpl(final String name, final ODataValue value) { + super(name, value); + } + + @Override + public ODataComplexValue getComplexValue() { + return hasComplexValue() ? getValue().asComplex() : null; + } + + @Override + public ODataCollectionValue getCollectionValue() { + return hasCollectionValue() ? getValue().asCollection() : null; + } + +} 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 000000000..b0e0539fa --- /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 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; + } +} 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 000000000..7c6e72fae --- /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 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; + } + +} 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 000000000..b5ac7998c --- /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 properties = new ArrayList(); + + 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 getProperties() { + return properties; + } + +} 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 000000000..cbc5a04e9 --- /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 entities = new ArrayList(); + + public ODataEntitySetImpl() { + } + + public ODataEntitySetImpl(final URI next) { + super(next); + } + + @Override + protected int getEntitiesSize() { + return entities.size(); + } + + @Override + public List getEntities() { + return entities; + } + +} 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 000000000..ee2101804 --- /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; + } + +} 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 000000000..4f46a76b5 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java @@ -0,0 +1,107 @@ +/* + * 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.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.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.domain.v4.ODataValue; +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 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 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); + } + + @Override + public ODataProperty newEnumProperty(final String name, final ODataEnumValue value) { + return new ODataPropertyImpl(name, value); + } + +} 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 000000000..0d7ace801 --- /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; + } + +} 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 000000000..85cdf6727 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.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.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 { + + 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; + } + + @Override + public ODataComplexValue getComplexValue() { + return hasComplexValue() ? getValue().asComplex() : null; + } + + @Override + public ODataCollectionValue getCollectionValue() { + return hasCollectionValue() ? getValue().asCollection() : null; + } + +} 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 41eb36832..1f77188e5 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 @@ -33,123 +33,123 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName; public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements EdmEntityContainer { - protected final FullQualifiedName entityContainerName; + protected final FullQualifiedName entityContainerName; + protected final Map singletons = new HashMap(); + private boolean allSingletonsLoaded = false; + protected final Map entitySets = new HashMap(); + private boolean allEntitySetsLoaded = false; + protected final Map actionImports = new HashMap(); + private final FullQualifiedName parentContainerName; + private boolean allActionImportsLoaded = false; + protected final Map functionImports = new HashMap(); + private boolean allFunctionImportsLoaded = false; - protected final Map singletons = new HashMap(); + public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName, + final FullQualifiedName parentContainerName) { + super(edm, entityContainerName.getName()); + this.entityContainerName = entityContainerName; + this.parentContainerName = parentContainerName; + } - private boolean allSingletonsLoaded = false; + @Override + public String getNamespace() { + return entityContainerName.getNamespace(); + } - protected final Map entitySets = new HashMap(); + protected abstract EdmSingleton createSingleton(String singletonName); - private boolean allEntitySetsLoaded = false; - - protected final Map actionImports = new HashMap(); - - private boolean allActionImportsLoaded = false; - - protected final Map functionImports = new HashMap(); - - private boolean allFunctionImportsLoaded = false; - - public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName) { - super(edm, entityContainerName.getName()); - this.entityContainerName = entityContainerName; + @Override + public EdmSingleton getSingleton(final String singletonName) { + EdmSingleton singleton = singletons.get(singletonName); + if (singleton == null) { + singleton = createSingleton(singletonName); + singletons.put(singletonName, singleton); } + return singleton; + } - @Override - public String getNamespace() { - return entityContainerName.getNamespace(); + 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; + } - protected abstract EdmSingleton createSingleton(String singletonName); + protected abstract EdmActionImport createActionImport(String actionImportName); - @Override - public EdmSingleton getSingleton(final String singletonName) { - EdmSingleton singleton = singletons.get(singletonName); - if (singleton == null) { - singleton = createSingleton(singletonName); - singletons.put(singletonName, singleton); - } - return singleton; + @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 EdmEntitySet createEntitySet(String entitySetName); + protected abstract EdmFunctionImport createFunctionImport(String functionImportName); - @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 EdmFunctionImport getFunctionImport(final String functionImportName) { + EdmFunctionImport functionImport = functionImports.get(functionImportName); + if (functionImport == null) { + functionImport = createFunctionImport(functionImportName); + functionImports.put(functionImportName, functionImport); } + return functionImport; + } - 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 List getEntitySets() { + if (!allEntitySetsLoaded) { + loadAllEntitySets(); + allEntitySetsLoaded = true; } + return new ArrayList(entitySets.values()); + } - protected abstract EdmFunctionImport createFunctionImport(String functionImportName); + protected abstract void loadAllEntitySets(); - @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 List getFunctionImports() { + if (!allFunctionImportsLoaded) { + loadAllFunctionImports(); + allFunctionImportsLoaded = true; } + return new ArrayList(functionImports.values()); + } - @Override - public List getEntitySets() { - if (!allEntitySetsLoaded) { - loadAllEntitySets(); - allEntitySetsLoaded = true; - } - return new ArrayList(entitySets.values()); + protected abstract void loadAllFunctionImports(); + + @Override + public List getSingletons() { + if (!allSingletonsLoaded) { + loadAllSingletons(); + allSingletonsLoaded = true; } + return new ArrayList(singletons.values()); + } - protected abstract void loadAllEntitySets(); + protected abstract void loadAllSingletons(); - @Override - public List getFunctionImports() { - if (!allFunctionImportsLoaded) { - loadAllFunctionImports(); - allFunctionImportsLoaded = true; - } - return new ArrayList(functionImports.values()); + @Override + public List getActionImports() { + if (!allActionImportsLoaded) { + loadAllActionImports(); + allActionImportsLoaded = true; } + return new ArrayList(actionImports.values()); + } - protected abstract void loadAllFunctionImports(); + protected abstract void loadAllActionImports(); - @Override - public List getSingletons() { - if (!allSingletonsLoaded) { - loadAllSingletons(); - allSingletonsLoaded = true; - } - return new ArrayList(singletons.values()); - } - - protected abstract void loadAllSingletons(); - - @Override - public List getActionImports() { - if (!allActionImportsLoaded) { - loadAllActionImports(); - allActionImportsLoaded = true; - } - return new ArrayList(actionImports.values()); - } - - protected abstract void loadAllActionImports(); + @Override + public FullQualifiedName getParentContainerName() { + return parentContainerName; + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java index 8fcf143f2..d6f4fd339 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java @@ -202,5 +202,10 @@ public abstract class AbstractEdmEnumType extends EdmTypeImpl implements EdmEnum throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(literal)"); } } + + @Override + public boolean isFlags() { + return isFlags; + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java index 09bd8ce0f..90761a7c0 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java @@ -44,7 +44,7 @@ public abstract class AbstractEdmParameter extends EdmElementImpl implements Edm if (typeImpl == null) { if (EdmPrimitiveType.EDM_NAMESPACE.equals(paramType.getNamespace())) { try { - typeImpl = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.valueOf(paramType.getName())); + typeImpl = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.valueOf(paramType.getName())); } catch (IllegalArgumentException e) { throw new EdmException("Cannot find type with name: " + paramType, e); } 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 000000000..233e5d255 --- /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; + } + +} 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 000000000..93e151976 --- /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; + } +} diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java index 09e70cb84..97b01b374 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java @@ -96,7 +96,6 @@ public class EdmTypeInfo { baseType = typeExpression.substring(collStartIdx + 11, collEndIdx); } - baseType = baseType.replaceAll("^#", ""); final String typeName; diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java deleted file mode 100644 index 8e5cb6ff5..000000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java +++ /dev/null @@ -1,76 +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.primitivetype; - -import org.apache.olingo.commons.api.edm.EdmGeospatialType; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; -import org.apache.olingo.commons.api.edm.geo.Geospatial; -import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension; -import org.apache.olingo.commons.api.edm.geo.Geospatial.Type; - -public abstract class AbstractEdmGeospatialType implements EdmGeospatialType { - - private final Class reference; - - protected final Dimension dimension; - - protected final Type type; - - protected AbstractEdmGeospatialType(final Class reference, final Dimension dimension, final Type type) { - this.reference = reference; - this.dimension = dimension; - this.type = type; - } - - @Override - public Class getJavaType() { - return reference; - } - - @Override - public String getNamespace() { - return EDM_NAMESPACE; - } - - @Override - public String getName() { - return getClass().getSimpleName().substring(3); - } - - @Override - public EdmTypeKind getKind() { - return EdmTypeKind.PRIMITIVE; - } - - @Override - public boolean equals(final Object obj) { - return this == obj || obj != null && getClass() == obj.getClass(); - } - - @Override - public int hashCode() { - return getClass().hashCode(); - } - - @Override - public String toString() { - return new FullQualifiedName(getNamespace(), getName()).getFullQualifiedNameAsString(); - } -} diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractGeospatialType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractGeospatialType.java new file mode 100644 index 000000000..7a61a53cd --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractGeospatialType.java @@ -0,0 +1,539 @@ +/* + * 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.primitivetype; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; +import org.apache.olingo.commons.api.edm.geo.Geospatial; +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.LineString; +import org.apache.olingo.commons.api.edm.geo.MultiLineString; +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; + +public abstract class AbstractGeospatialType extends SingletonPrimitiveType { + + private static final Pattern PATTERN = + Pattern.compile("([a-z]+)'SRID=([0-9]+);([a-zA-Z]+)\\((.*)\\)'"); + + private static final Pattern COLLECTION_PATTERN = + Pattern.compile("([a-z]+)'SRID=([0-9]+);Collection\\(([a-zA-Z]+)\\((.*)\\)\\)'"); + + private final Class reference; + + protected final Dimension dimension; + + protected final Type type; + + protected AbstractGeospatialType(final Class reference, final Dimension dimension, final Type type) { + this.reference = reference; + this.dimension = dimension; + this.type = type; + } + + @Override + public Class getDefaultType() { + return reference; + } + + private Matcher getMatcher(final Pattern pattern, final String value) throws EdmPrimitiveTypeException { + final Matcher matcher = pattern.matcher(value); + if (!matcher.matches()) { + throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)"); + } + + Geospatial.Dimension _dimension = null; + Geospatial.Type _type = null; + try { + _dimension = Geospatial.Dimension.valueOf(matcher.group(1).toUpperCase()); + _type = Geospatial.Type.valueOf(matcher.group(3).toUpperCase()); + } catch (IllegalArgumentException e) { + throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e); + } + if (_dimension != this.dimension || (!pattern.equals(COLLECTION_PATTERN) && _type != this.type)) { + throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)"); + } + + return matcher; + } + + private Point newPoint(final Integer srid, final String point, final Boolean isNullable, + final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) + throws EdmPrimitiveTypeException { + + final String[] pointCoo = StringUtils.split(point, ' '); + if (pointCoo == null || pointCoo.length != 2) { + throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)"); + } + + final Point result = new Point(this.dimension, srid); + result.setX(EdmDouble.getInstance().valueOfString(pointCoo[0], + isNullable, maxLength, precision, scale, isUnicode, Double.class)); + result.setY(EdmDouble.getInstance().valueOfString(pointCoo[1], + isNullable, maxLength, precision, scale, isUnicode, Double.class)); + + return result; + } + + protected Point stringToPoint(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + final Matcher matcher = getMatcher(PATTERN, value); + + return newPoint(Integer.valueOf(matcher.group(2)), matcher.group(4), + isNullable, maxLength, precision, scale, isUnicode); + } + + protected MultiPoint stringToMultiPoint(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + final Matcher matcher = getMatcher(PATTERN, value); + + final List points = new ArrayList(); + for (String pointCoo : StringUtils.split(matcher.group(4), ',')) { + points.add(newPoint(null, pointCoo.substring(1, pointCoo.length() - 1), + isNullable, maxLength, precision, scale, isUnicode)); + } + + return new MultiPoint(dimension, Integer.valueOf(matcher.group(2)), points); + } + + private LineString newLineString(final Integer srid, final String lineString, final Boolean isNullable, + final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) + throws EdmPrimitiveTypeException { + + final List points = new ArrayList(); + for (String pointCoo : StringUtils.split(lineString, ',')) { + points.add(newPoint(null, pointCoo, isNullable, maxLength, precision, scale, isUnicode)); + } + + return new LineString(this.dimension, srid, points); + } + + protected LineString stringToLineString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + final Matcher matcher = getMatcher(PATTERN, value); + + return newLineString(Integer.valueOf(matcher.group(2)), matcher.group(4), + isNullable, maxLength, precision, scale, isUnicode); + } + + protected MultiLineString stringToMultiLineString(final String value, final Boolean isNullable, + final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) + throws EdmPrimitiveTypeException { + + final Matcher matcher = getMatcher(PATTERN, value); + + final List lineStrings = new ArrayList(); + for (String coo : matcher.group(4).contains("),(") + ? matcher.group(4).split("\\),\\(") : new String[] {matcher.group(4)}) { + + String lineString = coo; + if (lineString.charAt(0) == '(') { + lineString = lineString.substring(1); + } + if (lineString.endsWith(")")) { + lineString = StringUtils.substringBeforeLast(lineString, ")"); + } + + lineStrings.add(newLineString(null, lineString, isNullable, maxLength, precision, scale, isUnicode)); + } + + return new MultiLineString(this.dimension, Integer.valueOf(matcher.group(2)), lineStrings); + } + + private Polygon newPolygon(final Integer srid, final String polygon, final Boolean isNullable, + final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) + throws EdmPrimitiveTypeException { + + final String[] first = polygon.split("\\),\\("); + + final List interior = new ArrayList(); + for (String pointCoo : StringUtils.split(first[0].substring(1, first[0].length()), ',')) { + interior.add(newPoint(null, pointCoo, isNullable, maxLength, precision, scale, isUnicode)); + } + final List exterior = new ArrayList(); + for (String pointCoo : StringUtils.split(first[1].substring(0, first[1].length() - 1), ',')) { + exterior.add(newPoint(null, pointCoo, isNullable, maxLength, precision, scale, isUnicode)); + } + + return new Polygon(dimension, srid, interior, exterior); + } + + protected Polygon stringToPolygon(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + final Matcher matcher = getMatcher(PATTERN, value); + + return newPolygon(Integer.valueOf(matcher.group(2)), matcher.group(4), + isNullable, maxLength, precision, scale, isUnicode); + } + + protected MultiPolygon stringToMultiPolygon(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + final Matcher matcher = getMatcher(PATTERN, value); + + final List polygons = new ArrayList(); + for (String coo : matcher.group(4).contains(")),((") + ? matcher.group(4).split("\\)\\),\\(\\(") : new String[] {matcher.group(4)}) { + + String polygon = coo; + if (polygon.startsWith("((")) { + polygon = polygon.substring(1); + } + if (polygon.endsWith("))")) { + polygon = StringUtils.substringBeforeLast(polygon, ")"); + } + if (polygon.charAt(0) != '(') { + polygon = "(" + polygon; + } + if (!polygon.endsWith(")")) { + polygon += ")"; + } + + polygons.add(newPolygon(null, polygon, isNullable, maxLength, precision, scale, isUnicode)); + } + + return new MultiPolygon(dimension, Integer.valueOf(matcher.group(2)), polygons); + } + + protected GeospatialCollection stringToCollection(final String value, final Boolean isNullable, + final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) + throws EdmPrimitiveTypeException { + + final Matcher matcher = getMatcher(COLLECTION_PATTERN, value); + + Geospatial item = null; + switch (Geospatial.Type.valueOf(matcher.group(3).toUpperCase())) { + case POINT: + item = newPoint(Integer.valueOf(matcher.group(2)), matcher.group(4), + isNullable, maxLength, precision, scale, isUnicode); + break; + + case MULTIPOINT: + final List points = new ArrayList(); + for (String pointCoo : StringUtils.split(matcher.group(4), ',')) { + points.add(newPoint(null, pointCoo.substring(1, pointCoo.length() - 1), + isNullable, maxLength, precision, scale, isUnicode)); + } + + item = new MultiPoint(dimension, Integer.valueOf(matcher.group(2)), points); + break; + + case LINESTRING: + item = newLineString(Integer.valueOf(matcher.group(2)), matcher.group(4), + isNullable, maxLength, precision, scale, isUnicode); + break; + + case MULTILINESTRING: + final List lineStrings = new ArrayList(); + for (String coo : StringUtils.split(matcher.group(4), ',')) { + lineStrings.add(newLineString(null, coo.substring(1, coo.length() - 1), + isNullable, maxLength, precision, scale, isUnicode)); + } + + item = new MultiLineString(this.dimension, Integer.valueOf(matcher.group(2)), lineStrings); + break; + + case POLYGON: + item = newPolygon(Integer.valueOf(matcher.group(2)), matcher.group(4), + isNullable, maxLength, precision, scale, isUnicode); + break; + + case MULTIPOLYGON: + final List polygons = new ArrayList(); + for (String coo : StringUtils.split(matcher.group(4), ',')) { + polygons.add(newPolygon(null, coo.substring(1, coo.length() - 1), + isNullable, maxLength, precision, scale, isUnicode)); + } + + item = new MultiPolygon(dimension, Integer.valueOf(matcher.group(2)), polygons); + break; + + default: + } + + return new GeospatialCollection(dimension, Integer.valueOf(matcher.group(2)), + Collections.singletonList(item)); + } + + private StringBuilder toStringBuilder(final Integer srid) { + return new StringBuilder(dimension.name().toLowerCase()).append('\''). + append("SRID=").append(srid).append(';'); + } + + private String point(final Point point, final Boolean isNullable, + final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) + throws EdmPrimitiveTypeException { + + return new StringBuilder(). + append(EdmDouble.getInstance().valueToString(point.getX(), + isNullable, maxLength, precision, scale, isUnicode)). + append(' '). + append(EdmDouble.getInstance().valueToString(point.getY(), + isNullable, maxLength, precision, scale, isUnicode)). + toString(); + } + + protected String toString(final Point point, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (dimension != point.getDimension()) { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)"); + } + + return toStringBuilder(point.getSrid()). + append(reference.getSimpleName()). + append('('). + append(point(point, isNullable, maxLength, precision, scale, isUnicode)). + append(")'"). + toString(); + } + + protected String toString(final MultiPoint multiPoint, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (dimension != multiPoint.getDimension()) { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)"); + } + + final StringBuilder result = toStringBuilder(multiPoint.getSrid()). + append(reference.getSimpleName()). + append('('); + + for (final Iterator itor = multiPoint.iterator(); itor.hasNext();) { + result.append('('). + append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode)). + append(')'); + if (itor.hasNext()) { + result.append(','); + } + } + + return result.append(")'").toString(); + } + + private String lineString(final LineString lineString, final Boolean isNullable, + final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) + throws EdmPrimitiveTypeException { + + final StringBuilder result = new StringBuilder(); + + for (final Iterator itor = lineString.iterator(); itor.hasNext();) { + result.append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode)); + if (itor.hasNext()) { + result.append(','); + } + } + + return result.toString(); + } + + protected String toString(final LineString lineString, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (dimension != lineString.getDimension()) { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)"); + } + + return toStringBuilder(lineString.getSrid()). + append(reference.getSimpleName()). + append('('). + append(lineString(lineString, isNullable, maxLength, precision, scale, isUnicode)). + append(")'").toString(); + } + + protected String toString(final MultiLineString multiLineString, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (dimension != multiLineString.getDimension()) { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)"); + } + + final StringBuilder result = toStringBuilder(multiLineString.getSrid()). + append(reference.getSimpleName()). + append('('); + + for (final Iterator itor = multiLineString.iterator(); itor.hasNext();) { + result.append('('). + append(lineString(itor.next(), isNullable, maxLength, precision, scale, isUnicode)). + append(')'); + if (itor.hasNext()) { + result.append(','); + } + } + + return result.append(")'").toString(); + } + + private String polygon(final Polygon polygon, final Boolean isNullable, + final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) + throws EdmPrimitiveTypeException { + + final StringBuilder result = new StringBuilder(); + + result.append('('); + for (final Iterator itor = polygon.getInterior().iterator(); itor.hasNext();) { + result.append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode)); + if (itor.hasNext()) { + result.append(','); + } + } + result.append("),("); + for (final Iterator itor = polygon.getExterior().iterator(); itor.hasNext();) { + result.append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode)); + if (itor.hasNext()) { + result.append(','); + } + } + + return result.append(')').toString(); + } + + protected String toString(final Polygon polygon, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (dimension != polygon.getDimension()) { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)"); + } + + return toStringBuilder(polygon.getSrid()). + append(reference.getSimpleName()). + append('('). + append(polygon(polygon, isNullable, maxLength, precision, scale, isUnicode)). + append(")'").toString(); + } + + protected String toString(final MultiPolygon multiPolygon, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (dimension != multiPolygon.getDimension()) { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)"); + } + + final StringBuilder result = toStringBuilder(multiPolygon.getSrid()). + append(reference.getSimpleName()). + append('('); + + for (final Iterator itor = multiPolygon.iterator(); itor.hasNext();) { + result.append('('). + append(polygon(itor.next(), isNullable, maxLength, precision, scale, isUnicode)). + append(')'); + if (itor.hasNext()) { + result.append(','); + } + } + + return result.append(")'").toString(); + } + + protected String toString(final GeospatialCollection collection, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (dimension != collection.getDimension()) { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)"); + } + + final StringBuilder result = toStringBuilder(collection.getSrid()). + append("Collection("); + + if (collection.iterator().hasNext()) { + final Geospatial item = collection.iterator().next(); + result.append(item.getClass().getSimpleName()).append('('); + + switch (item.getEdmPrimitiveTypeKind()) { + case GeographyPoint: + case GeometryPoint: + result.append(point((Point) item, isNullable, maxLength, precision, scale, isUnicode)); + break; + + case GeographyMultiPoint: + case GeometryMultiPoint: + for (final Iterator itor = ((MultiPoint) item).iterator(); itor.hasNext();) { + result.append('('). + append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode)). + append(')'); + if (itor.hasNext()) { + result.append(','); + } + } + break; + + case GeographyLineString: + case GeometryLineString: + result.append(lineString((LineString) item, isNullable, maxLength, precision, scale, isUnicode)); + break; + + case GeographyMultiLineString: + case GeometryMultiLineString: + for (final Iterator itor = ((MultiLineString) item).iterator(); itor.hasNext();) { + result.append('('). + append(lineString(itor.next(), isNullable, maxLength, precision, scale, isUnicode)). + append(')'); + if (itor.hasNext()) { + result.append(','); + } + } + break; + + case GeographyPolygon: + case GeometryPolygon: + result.append(polygon((Polygon) item, isNullable, maxLength, precision, scale, isUnicode)); + break; + + case GeographyMultiPolygon: + case GeometryMultiPolygon: + for (final Iterator itor = ((MultiPolygon) item).iterator(); itor.hasNext();) { + result.append('('). + append(polygon(itor.next(), isNullable, maxLength, precision, scale, isUnicode)). + append(')'); + if (itor.hasNext()) { + result.append(','); + } + } + break; + + default: + } + + result.append(')'); + } + + return result.append(")'").toString(); + } +} diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java index f5951cbc7..4fc8dcf61 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java @@ -18,10 +18,11 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.geo.Geospatial; import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension; -public final class EdmGeography extends AbstractEdmGeospatialType { +public final class EdmGeography extends AbstractGeospatialType { private static final EdmGeography INSTANCE = new EdmGeography(); @@ -33,4 +34,20 @@ public final class EdmGeography extends AbstractEdmGeospatialType { super(Geospatial.class, Dimension.GEOGRAPHY, null); } + @Override + protected T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, final Class returnType) + throws EdmPrimitiveTypeException { + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java index aab7210c9..7c4f4469f 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.GeospatialCollection; -public final class EdmGeographyCollection extends AbstractEdmGeospatialType { +public final class EdmGeographyCollection extends AbstractGeospatialType { private static final EdmGeographyCollection INSTANCE = new EdmGeographyCollection(); @@ -31,7 +32,33 @@ public final class EdmGeographyCollection extends AbstractEdmGeospatialType T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final GeospatialCollection collection = + stringToCollection(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(GeospatialCollection.class)) { + return returnType.cast(collection); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof GeospatialCollection) { + return toString((GeospatialCollection) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java index 23c92cc20..85f1b7bef 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.LineString; -public final class EdmGeographyLineString extends AbstractEdmGeospatialType { +public final class EdmGeographyLineString extends AbstractGeospatialType { private static final EdmGeographyLineString INSTANCE = new EdmGeographyLineString(); @@ -31,7 +32,32 @@ public final class EdmGeographyLineString extends AbstractEdmGeospatialType T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final LineString lineString = stringToLineString(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(LineString.class)) { + return returnType.cast(lineString); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof LineString) { + return toString((LineString) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java index 9b5901df4..90c65ebd3 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.MultiLineString; -public final class EdmGeographyMultiLineString extends AbstractEdmGeospatialType { +public final class EdmGeographyMultiLineString extends AbstractGeospatialType { private static final EdmGeographyMultiLineString INSTANCE = new EdmGeographyMultiLineString(); @@ -31,7 +32,33 @@ public final class EdmGeographyMultiLineString extends AbstractEdmGeospatialType } public EdmGeographyMultiLineString() { - super(Point.class, Dimension.GEOGRAPHY, Type.MULTILINESTRING); + super(MultiLineString.class, Dimension.GEOGRAPHY, Type.MULTILINESTRING); } + @Override + protected T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final MultiLineString multiLineString = + stringToMultiLineString(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(MultiLineString.class)) { + return returnType.cast(multiLineString); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof MultiLineString) { + return toString((MultiLineString) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } 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 db6604188..c393bb590 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 @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.MultiPoint; -public final class EdmGeographyMultiPoint extends AbstractEdmGeospatialType { +public final class EdmGeographyMultiPoint extends AbstractGeospatialType { private static final EdmGeographyMultiPoint INSTANCE = new EdmGeographyMultiPoint(); @@ -31,7 +32,34 @@ public final class EdmGeographyMultiPoint extends AbstractEdmGeospatialType T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, final Class returnType) + throws EdmPrimitiveTypeException { + + final MultiPoint point = stringToMultiPoint(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(MultiPoint.class)) { + return returnType.cast(point); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof MultiPoint) { + return toString((MultiPoint) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java index 4b53a30a2..9dde1074b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.MultiPolygon; -public final class EdmGeographyMultiPolygon extends AbstractEdmGeospatialType { +public final class EdmGeographyMultiPolygon extends AbstractGeospatialType { private static final EdmGeographyMultiPolygon INSTANCE = new EdmGeographyMultiPolygon(); @@ -31,7 +32,32 @@ public final class EdmGeographyMultiPolygon extends AbstractEdmGeospatialType T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final MultiPolygon multiPolygon = stringToMultiPolygon(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(MultiPolygon.class)) { + return returnType.cast(multiPolygon); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof MultiPolygon) { + return toString((MultiPolygon) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java index 61abce333..637709d5f 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; -public final class EdmGeographyPoint extends AbstractEdmGeospatialType { +public final class EdmGeographyPoint extends AbstractGeospatialType { private static final EdmGeographyPoint INSTANCE = new EdmGeographyPoint(); @@ -34,4 +35,30 @@ public final class EdmGeographyPoint extends AbstractEdmGeospatialType { super(Point.class, Dimension.GEOGRAPHY, Type.POINT); } + @Override + protected T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final Point point = stringToPoint(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(Point.class)) { + return returnType.cast(point); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof Point) { + return toString((Point) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } + } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java index a7a1a6cd0..5f5e2dbf8 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.Polygon; -public final class EdmGeographyPolygon extends AbstractEdmGeospatialType { +public final class EdmGeographyPolygon extends AbstractGeospatialType { private static final EdmGeographyPolygon INSTANCE = new EdmGeographyPolygon(); @@ -31,7 +32,32 @@ public final class EdmGeographyPolygon extends AbstractEdmGeospatialType } public EdmGeographyPolygon() { - super(Point.class, Dimension.GEOGRAPHY, Type.POLYGON); + super(Polygon.class, Dimension.GEOGRAPHY, Type.POLYGON); } + @Override + protected T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final Polygon polygon = stringToPolygon(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(Polygon.class)) { + return returnType.cast(polygon); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof Polygon) { + return toString((Polygon) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java index 2f16e24c2..3c191861c 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java @@ -18,10 +18,11 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.geo.Geospatial; import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension; -public final class EdmGeometry extends AbstractEdmGeospatialType { +public final class EdmGeometry extends AbstractGeospatialType { private static final EdmGeometry INSTANCE = new EdmGeometry(); @@ -33,4 +34,20 @@ public final class EdmGeometry extends AbstractEdmGeospatialType { super(Geospatial.class, Dimension.GEOMETRY, null); } + @Override + protected T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, final Class returnType) + throws EdmPrimitiveTypeException { + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } 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 12c6c01d1..3000e84e0 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 @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.GeospatialCollection; -public final class EdmGeometryCollection extends AbstractEdmGeospatialType { +public final class EdmGeometryCollection extends AbstractGeospatialType { private static final EdmGeometryCollection INSTANCE = new EdmGeometryCollection(); @@ -31,7 +32,33 @@ public final class EdmGeometryCollection extends AbstractEdmGeospatialType T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final GeospatialCollection collection = + stringToCollection(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(GeospatialCollection.class)) { + return returnType.cast(collection); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof GeospatialCollection) { + return toString((GeospatialCollection) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java index db8cfb004..dbe0edac5 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.LineString; -public final class EdmGeometryLineString extends AbstractEdmGeospatialType { +public final class EdmGeometryLineString extends AbstractGeospatialType { private static final EdmGeometryLineString INSTANCE = new EdmGeometryLineString(); @@ -31,7 +32,32 @@ public final class EdmGeometryLineString extends AbstractEdmGeospatialType T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final LineString lineString = stringToLineString(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(LineString.class)) { + return returnType.cast(lineString); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof LineString) { + return toString((LineString) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java index 7bf89e6c7..5ed7ed0fc 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.MultiLineString; -public final class EdmGeometryMultiLineString extends AbstractEdmGeospatialType { +public final class EdmGeometryMultiLineString extends AbstractGeospatialType { private static final EdmGeometryMultiLineString INSTANCE = new EdmGeometryMultiLineString(); @@ -31,7 +32,33 @@ public final class EdmGeometryMultiLineString extends AbstractEdmGeospatialType< } public EdmGeometryMultiLineString() { - super(Point.class, Dimension.GEOMETRY, Type.MULTILINESTRING); + super(MultiLineString.class, Dimension.GEOMETRY, Type.MULTILINESTRING); } + @Override + protected T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final MultiLineString multiLineString = + stringToMultiLineString(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(MultiLineString.class)) { + return returnType.cast(multiLineString); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof MultiLineString) { + return toString((MultiLineString) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java index 9311d8de8..30f7a2619 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.MultiPoint; -public final class EdmGeometryMultiPoint extends AbstractEdmGeospatialType { +public final class EdmGeometryMultiPoint extends AbstractGeospatialType { private static final EdmGeometryMultiPoint INSTANCE = new EdmGeometryMultiPoint(); @@ -31,7 +32,33 @@ public final class EdmGeometryMultiPoint extends AbstractEdmGeospatialType T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, final Class returnType) + throws EdmPrimitiveTypeException { + + final MultiPoint point = stringToMultiPoint(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(MultiPoint.class)) { + return returnType.cast(point); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof MultiPoint) { + return toString((MultiPoint) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java index f64ed8705..284badab8 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.MultiPolygon; -public final class EdmGeometryMultiPolygon extends AbstractEdmGeospatialType { +public final class EdmGeometryMultiPolygon extends AbstractGeospatialType { private static final EdmGeometryMultiPolygon INSTANCE = new EdmGeometryMultiPolygon(); @@ -31,7 +32,33 @@ public final class EdmGeometryMultiPolygon extends AbstractEdmGeospatialType T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final MultiPolygon multiPolygon = + stringToMultiPolygon(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(MultiPolygon.class)) { + return returnType.cast(multiPolygon); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof MultiPolygon) { + return toString((MultiPolygon) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java index ba8e5d287..eaf88f877 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; -public final class EdmGeometryPoint extends AbstractEdmGeospatialType { +public final class EdmGeometryPoint extends AbstractGeospatialType { private static final EdmGeometryPoint INSTANCE = new EdmGeometryPoint(); @@ -34,4 +35,29 @@ public final class EdmGeometryPoint extends AbstractEdmGeospatialType { super(Point.class, Dimension.GEOMETRY, Type.POINT); } + @Override + protected T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final Point point = stringToPoint(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(Point.class)) { + return returnType.cast(point); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof Point) { + return toString((Point) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java index 12f8cf118..5e86753bd 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java @@ -18,11 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +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.Point; +import org.apache.olingo.commons.api.edm.geo.Polygon; -public final class EdmGeometryPolygon extends AbstractEdmGeospatialType { +public final class EdmGeometryPolygon extends AbstractGeospatialType { private static final EdmGeometryPolygon INSTANCE = new EdmGeometryPolygon(); @@ -31,7 +32,32 @@ public final class EdmGeometryPolygon extends AbstractEdmGeospatialType { } public EdmGeometryPolygon() { - super(Point.class, Dimension.GEOMETRY, Type.POLYGON); + super(Polygon.class, Dimension.GEOMETRY, Type.POLYGON); } + @Override + protected T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode, + final Class returnType) throws EdmPrimitiveTypeException { + + final Polygon polygon = stringToPolygon(value, isNullable, maxLength, precision, scale, isUnicode); + if (returnType.isAssignableFrom(Polygon.class)) { + return returnType.cast(polygon); + } else { + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)"); + } + } + + @Override + protected String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength, + final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { + + if (value instanceof Polygon) { + return toString((Polygon) value, isNullable, maxLength, precision, scale, isUnicode); + } + + throw new EdmPrimitiveTypeException( + "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())"); + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java index 83a257dbe..4d2f3df05 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java @@ -18,27 +18,18 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; -import org.apache.olingo.commons.api.edm.EdmGeospatialType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.apache.olingo.commons.api.edm.EdmType; public final class EdmPrimitiveTypeFactory { - public static EdmType getInstance(final EdmPrimitiveTypeKind kind) { - return kind.isGeospatial() - ? getGeoInstance(kind) - : getNonGeoInstance(kind); - } - /** - * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType} (for - * non-geospatial types). + * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType}. * * @param kind EdmPrimitiveTypeKind * @return {@link EdmPrimitiveType} instance */ - public static EdmPrimitiveType getNonGeoInstance(final EdmPrimitiveTypeKind kind) { + public static EdmPrimitiveType getInstance(final EdmPrimitiveTypeKind kind) { switch (kind) { case Binary: return EdmBinary.getInstance(); @@ -79,19 +70,6 @@ public final class EdmPrimitiveTypeFactory { case Stream: return EdmStream.getInstance(); - default: - throw new IllegalArgumentException("Wrong type: " + kind); - } - } - - /** - * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmGeospatialType}. - * - * @param kind EdmPrimitiveTypeKind - * @return {@link EdmGeospatialType} instance - */ - public static EdmGeospatialType getGeoInstance(final EdmPrimitiveTypeKind kind) { - switch (kind) { case Geography: return EdmGeography.getInstance(); case GeographyPoint: @@ -111,7 +89,7 @@ public final class EdmPrimitiveTypeFactory { case Geometry: return EdmGeometry.getInstance(); case GeometryPoint: - return EdmGeometry.getInstance(); + return EdmGeometryPoint.getInstance(); case GeometryLineString: return EdmGeometryLineString.getInstance(); case GeometryPolygon: @@ -119,7 +97,7 @@ public final class EdmPrimitiveTypeFactory { case GeometryMultiPoint: return EdmGeometryMultiPoint.getInstance(); case GeometryMultiLineString: - return EdmGeographyMultiLineString.getInstance(); + return EdmGeometryMultiLineString.getInstance(); case GeometryMultiPolygon: return EdmGeometryMultiPolygon.getInstance(); case GeometryCollection: @@ -127,7 +105,6 @@ public final class EdmPrimitiveTypeFactory { default: throw new IllegalArgumentException("Wrong type: " + kind); - } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java index 75e80cfb8..8f522534b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java @@ -34,6 +34,11 @@ public final class EdmTime extends SingletonPrimitiveType { return INSTANCE; } + { + uriPrefix = "time'"; + uriSuffix = "'"; + } + @Override public Class getDefaultType() { return Duration.class; 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 991e72329..ceb6b7e6b 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,7 +18,9 @@ */ package org.apache.olingo.commons.core.op; +import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; +import java.lang.reflect.Type; import org.apache.olingo.commons.api.data.Entry; import org.apache.olingo.commons.api.domain.ODataError; import org.apache.olingo.commons.api.data.Feed; @@ -28,14 +30,15 @@ import org.apache.olingo.commons.api.format.ODataPubFormat; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.api.op.CommonODataDeserializer; import org.apache.olingo.commons.core.data.AtomDeserializer; +import org.apache.olingo.commons.api.data.Container; 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 { @@ -50,55 +53,71 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl } @Override - public Feed toFeed(final InputStream input, final ODataPubFormat format) { + public Container toFeed(final InputStream input, final ODataPubFormat format) { return format == ODataPubFormat.ATOM - ? atom(input, AtomFeedImpl.class) - : json(input, JSONFeedImpl.class); + ? this.atom(input, AtomFeedImpl.class) + : this.json(input, JSONFeedImpl.class); } @Override - public Entry toEntry(final InputStream input, final ODataPubFormat format) { + public Container toEntry(final InputStream input, final ODataPubFormat format) { return format == ODataPubFormat.ATOM - ? atom(input, AtomEntryImpl.class) - : json(input, JSONEntryImpl.class); + ? this.atom(input, AtomEntryImpl.class) + : this.json(input, JSONEntryImpl.class); } @Override - public Property toProperty(final InputStream input, final ODataFormat format) { + public Container toProperty(final InputStream input, final ODataFormat format) { return format == ODataFormat.XML - ? atom(input, AtomPropertyImpl.class) - : json(input, JSONPropertyImpl.class); + ? this.atom(input, AtomPropertyImpl.class) + : this.json(input, JSONPropertyImpl.class); } @Override public ODataError toError(final InputStream input, final boolean isXML) { return isXML - ? xml(input, XMLErrorImpl.class) - : json(input, JSONErrorBundle.class).getError(); + ? this.atom(input, XMLODataErrorImpl.class).getObject() + : this.json(input, JSONODataErrorImpl.class).getObject(); } /* * ------------------ Protected methods ------------------ */ - protected T xml(final InputStream input, final Class reference) { + protected Container atom(final InputStream input, final Class reference) { try { - return getXmlMapper().readValue(input, reference); + return atomDeserializer.read(input, reference); } catch (Exception e) { throw new IllegalArgumentException("While deserializing " + reference.getName(), e); } } - protected T atom(final InputStream input, final Class reference) { + @SuppressWarnings("unchecked") + protected Container xml(final InputStream input, final Class reference) { try { - return atomDeserializer.read(input, reference); + final T obj = getXmlMapper().readValue(input, new TypeReference() { + @Override + public Type getType() { + return reference; + } + }); + + return obj instanceof Container ? (Container) obj : new Container(null, null, obj); } catch (Exception e) { throw new IllegalArgumentException("While deserializing " + reference.getName(), e); } } - protected T json(final InputStream input, final Class reference) { + @SuppressWarnings("unchecked") + protected Container json(final InputStream input, final Class reference) { try { - return getObjectMapper().readValue(input, reference); + final T obj = getObjectMapper().readValue(input, new TypeReference() { + @Override + public Type getType() { + return reference; + } + }); + + return obj instanceof Container ? (Container) obj : new Container(null, null, obj); } catch (Exception e) { throw new IllegalArgumentException("While deserializing " + reference.getName(), e); } diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java index dba916b36..267342734 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java @@ -41,9 +41,7 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest { assertEquals(EdmPrimitiveType.EDM_NAMESPACE, EdmInt32.getInstance().getNamespace()); for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { - final EdmType instance = kind.isGeospatial() - ? EdmPrimitiveTypeFactory.getGeoInstance(kind) - : EdmPrimitiveTypeFactory.getNonGeoInstance(kind); + final EdmType instance = EdmPrimitiveTypeFactory.getInstance(kind); assertEquals(EdmPrimitiveType.EDM_NAMESPACE, instance.getNamespace()); } } @@ -52,33 +50,29 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest { public void names() throws Exception { assertEquals("Uint7", Uint7.getInstance().getName()); - assertEquals("Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getName()); - assertEquals("Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getName()); - assertEquals("Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getName()); - assertEquals("Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getName()); + assertEquals("Binary", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary).getName()); + assertEquals("Boolean", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean).getName()); + assertEquals("Byte", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte).getName()); + assertEquals("Date", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date).getName()); assertEquals("DateTimeOffset", - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getName()); - assertEquals("Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getName()); - assertEquals("Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getName()); - assertEquals("Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getName()); - assertEquals("Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getName()); - assertEquals("Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getName()); - assertEquals("Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getName()); - assertEquals("Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getName()); - assertEquals("SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getName()); - assertEquals("Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getName()); - assertEquals("String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getName()); - assertEquals("TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getName()); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset).getName()); + assertEquals("Decimal", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal).getName()); + assertEquals("Double", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double).getName()); + assertEquals("Duration", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration).getName()); + assertEquals("Guid", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid).getName()); + assertEquals("Int16", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16).getName()); + assertEquals("Int32", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32).getName()); + assertEquals("Int64", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64).getName()); + assertEquals("SByte", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte).getName()); + assertEquals("Single", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single).getName()); + assertEquals("String", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String).getName()); + assertEquals("TimeOfDay", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay).getName()); } @Test public void kind() throws Exception { for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { - if (kind.isGeospatial()) { - assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getGeoInstance(kind).getKind()); - } else { - assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getNonGeoInstance(kind).getKind()); - } + assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getInstance(kind).getKind()); } } @@ -86,41 +80,37 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest { public void toStringAll() throws Exception { assertEquals("System.Uint7", Uint7.getInstance().toString()); - assertEquals("Edm.Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).toString()); - assertEquals("Edm.Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).toString()); - assertEquals("Edm.Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).toString()); - assertEquals("Edm.Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).toString()); + assertEquals("Edm.Binary", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary).toString()); + assertEquals("Edm.Boolean", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean).toString()); + assertEquals("Edm.Byte", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte).toString()); + assertEquals("Edm.Date", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date).toString()); assertEquals("Edm.DateTimeOffset", - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).toString()); - assertEquals("Edm.Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).toString()); - assertEquals("Edm.Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).toString()); - assertEquals("Edm.Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).toString()); - assertEquals("Edm.Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).toString()); - assertEquals("Edm.Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).toString()); - assertEquals("Edm.Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).toString()); - assertEquals("Edm.Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).toString()); - assertEquals("Edm.SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).toString()); - assertEquals("Edm.Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).toString()); - assertEquals("Edm.String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).toString()); - assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).toString()); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset).toString()); + assertEquals("Edm.Decimal", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal).toString()); + assertEquals("Edm.Double", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double).toString()); + assertEquals("Edm.Duration", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration).toString()); + assertEquals("Edm.Guid", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid).toString()); + assertEquals("Edm.Int16", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16).toString()); + assertEquals("Edm.Int32", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32).toString()); + assertEquals("Edm.Int64", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64).toString()); + assertEquals("Edm.SByte", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte).toString()); + assertEquals("Edm.Single", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single).toString()); + assertEquals("Edm.String", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String).toString()); + assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay).toString()); for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { - if (!kind.isGeospatial()) { - final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind); - assertEquals(instance.toString(), kind.getFullQualifiedName().toString()); - } + final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind); + assertEquals(instance.toString(), kind.getFullQualifiedName().toString()); } } @Test public void compatibility() { for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { - if (!kind.isGeospatial()) { - final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind); - assertTrue(instance.isCompatible(instance)); - assertFalse(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance( - (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String)))); - } + final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind); + assertTrue(instance.isCompatible(instance)); + assertFalse(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance( + (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String)))); } } @@ -128,71 +118,67 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest { public void defaultType() throws Exception { assertEquals(Byte.class, Uint7.getInstance().getDefaultType()); - assertEquals(byte[].class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getDefaultType()); + assertEquals(byte[].class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary).getDefaultType()); assertEquals(Boolean.class, - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getDefaultType()); - assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getDefaultType()); - assertEquals(Calendar.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getDefaultType()); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean).getDefaultType()); + assertEquals(Short.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte).getDefaultType()); + assertEquals(Calendar.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date).getDefaultType()); assertEquals(Calendar.class, - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getDefaultType()); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset).getDefaultType()); assertEquals(BigDecimal.class, - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getDefaultType()); - assertEquals(Double.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getDefaultType()); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal).getDefaultType()); + assertEquals(Double.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double).getDefaultType()); assertEquals(BigDecimal.class, - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getDefaultType()); - assertEquals(UUID.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getDefaultType()); - assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getDefaultType()); - assertEquals(Integer.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getDefaultType()); - assertEquals(Long.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getDefaultType()); - assertEquals(Byte.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getDefaultType()); - assertEquals(Float.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getDefaultType()); - assertEquals(String.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getDefaultType()); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration).getDefaultType()); + assertEquals(UUID.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid).getDefaultType()); + assertEquals(Short.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16).getDefaultType()); + assertEquals(Integer.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32).getDefaultType()); + assertEquals(Long.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64).getDefaultType()); + assertEquals(Byte.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte).getDefaultType()); + assertEquals(Float.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single).getDefaultType()); + assertEquals(String.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String).getDefaultType()); assertEquals(Calendar.class, - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getDefaultType()); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay).getDefaultType()); } @Test public void validate() throws Exception { for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { - if (!kind.isGeospatial()) { - final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind); - assertTrue(instance.validate(null, null, null, null, null, null)); - assertTrue(instance.validate(null, true, null, null, null, null)); - assertFalse(instance.validate(null, false, null, null, null, null)); - if (kind != EdmPrimitiveTypeKind.Stream) { - assertFalse(instance.validate("ä", null, null, null, null, false)); - } - if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary - && kind != EdmPrimitiveTypeKind.Stream) { + final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind); + assertTrue(instance.validate(null, null, null, null, null, null)); + assertTrue(instance.validate(null, true, null, null, null, null)); + assertFalse(instance.validate(null, false, null, null, null, null)); + if (kind != EdmPrimitiveTypeKind.Stream) { + assertFalse(instance.validate("ä", null, null, null, null, false)); + } + if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary + && kind != EdmPrimitiveTypeKind.Stream) { - assertFalse(instance.validate("", null, null, null, null, null)); - } - if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Stream) { - assertFalse(instance.validate("ä", null, null, null, null, null)); - } + assertFalse(instance.validate("", null, null, null, null, null)); + } + if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Stream) { + assertFalse(instance.validate("ä", null, null, null, null, null)); } } - assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary). + assertTrue(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary). validate("abcd", null, 3, null, null, null)); - assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary). + assertFalse(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary). validate("abcd", null, 2, null, null, null)); - assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal). + assertTrue(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal). validate("1", null, null, null, null, null)); - assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal). + assertFalse(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal). validate("1.2", null, null, null, 0, null)); } @Test public void uriLiteral() throws Exception { for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { - if (!kind.isGeospatial()) { - final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind); - assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test"))); - assertNull(instance.toUriLiteral(null)); - assertNull(instance.fromUriLiteral(null)); - } + final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind); + assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test"))); + assertNull(instance.toUriLiteral(null)); + assertNull(instance.fromUriLiteral(null)); } } } diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java index c3ff01c34..d052674b8 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java @@ -30,7 +30,7 @@ import org.junit.Test; public class EdmBinaryTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary); @Test public void validate() throws Exception { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java index d1e6580ee..01f269d8f 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java @@ -26,7 +26,7 @@ import org.junit.Test; public class EdmBooleanTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean); @Test public void toUriLiteral() throws Exception { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java index c560c39da..f02401c27 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java @@ -29,7 +29,7 @@ import org.junit.Test; public class EdmByteTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte); @Test public void compatibility() { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java index 6cc3d1924..d95fd99d0 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java @@ -30,7 +30,7 @@ import org.junit.Test; public class EdmDateTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date); @Test public void toUriLiteral() throws Exception { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java index bcc01232d..2a1e7d580 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java @@ -31,7 +31,7 @@ import org.junit.Test; public class EdmDateTimeOffsetTest extends PrimitiveTypeBaseTest { - final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset); + final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset); @Test public void toUriLiteral() throws Exception { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java index 35917af01..51185da42 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java @@ -30,18 +30,18 @@ import org.junit.Test; public class EdmDecimalTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal); @Test public void compatibility() { assertTrue(instance.isCompatible(Uint7.getInstance())); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double))); } @Test diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java index 57403ced3..340a48023 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java @@ -30,17 +30,17 @@ import org.junit.Test; public class EdmDoubleTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double); @Test public void compatibility() { assertTrue(instance.isCompatible(Uint7.getInstance())); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single))); } @Test diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java index 85745b4ae..e6797a480 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java @@ -29,7 +29,7 @@ import org.junit.Test; public class EdmDurationTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration); @Test public void toUriLiteral() throws Exception { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeoTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeoTest.java new file mode 100644 index 000000000..6b9dc9a3f --- /dev/null +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeoTest.java @@ -0,0 +1,174 @@ +/* + * 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.primitivetype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Iterator; +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; +import org.apache.olingo.commons.api.edm.geo.MultiLineString; +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.edm.EdmPrimitiveTypeException; +import org.junit.Test; + +public class EdmGeoTest extends PrimitiveTypeBaseTest { + + @Test + public void point() throws EdmPrimitiveTypeException { + final String input = "geometry'SRID=0;Point(142.1 64.1)'"; + + expectContentErrorInValueOfString(EdmGeographyPoint.getInstance(), input); + + final Point point = EdmGeometryPoint.getInstance().valueOfString(input, null, null, null, null, null, Point.class); + assertNotNull(point); + assertEquals(0, point.getSrid(), 0); + assertEquals(142.1, point.getX(), 0); + assertEquals(64.1, point.getY(), 0); + + assertEquals(input, EdmGeometryPoint.getInstance().valueToString(point, null, null, null, null, null)); + } + + @Test + public void multiPoint() throws EdmPrimitiveTypeException { + final String input = "geography'SRID=0;MultiPoint((142.1 64.1),(1.0 2.0))'"; + + expectContentErrorInValueOfString(EdmGeometryMultiPoint.getInstance(), input); + + MultiPoint multipoint = EdmGeographyMultiPoint.getInstance(). + valueOfString(input, null, null, null, null, null, MultiPoint.class); + assertNotNull(multipoint); + assertEquals(0, multipoint.getSrid(), 0); + assertEquals(142.1, multipoint.iterator().next().getX(), 0); + assertEquals(64.1, multipoint.iterator().next().getY(), 0); + + assertEquals(input, EdmGeographyMultiPoint.getInstance().valueToString(multipoint, null, null, null, null, null)); + + multipoint = EdmGeographyMultiPoint.getInstance(). + valueOfString("geography'SRID=0;MultiPoint()'", null, null, null, null, null, MultiPoint.class); + assertFalse(multipoint.iterator().hasNext()); + } + + @Test + public void lineString() throws EdmPrimitiveTypeException { + final String input = "geography'SRID=0;LineString(142.1 64.1,3.14 2.78)'"; + + expectContentErrorInValueOfString(EdmGeographyPoint.getInstance(), input); + expectContentErrorInValueOfString(EdmGeometryLineString.getInstance(), input); + + final LineString lineString = EdmGeographyLineString.getInstance(). + valueOfString(input, null, null, null, null, null, LineString.class); + assertNotNull(lineString); + assertEquals(0, lineString.getSrid(), 0); + final Iterator itor = lineString.iterator(); + assertEquals(142.1, itor.next().getX(), 0); + assertEquals(2.78, itor.next().getY(), 0); + + assertEquals(input, EdmGeographyLineString.getInstance().valueToString(lineString, null, null, null, null, null)); + } + + @Test + public void multiLineString() throws EdmPrimitiveTypeException { + final String input = "geography'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.7,3.14 2.78))'"; + + expectContentErrorInValueOfString(EdmGeographyPoint.getInstance(), input); + expectContentErrorInValueOfString(EdmGeometryLineString.getInstance(), input); + + final MultiLineString multiLineString = EdmGeographyMultiLineString.getInstance(). + valueOfString(input, null, null, null, null, null, MultiLineString.class); + assertNotNull(multiLineString); + assertEquals(0, multiLineString.getSrid(), 0); + final Iterator itor = multiLineString.iterator(); + assertEquals(142.1, itor.next().iterator().next().getX(), 0); + assertEquals(64.7, itor.next().iterator().next().getY(), 0); + + assertEquals(input, EdmGeographyMultiLineString.getInstance(). + valueToString(multiLineString, null, null, null, null, null)); + } + + @Test + public void polygon() throws EdmPrimitiveTypeException { + final String input = "geography'SRID=0;Polygon((1.0 1.0,1.0 1.0),(1.0 1.0,2.0 2.0,3.0 3.0,1.0 1.0))'"; + + expectContentErrorInValueOfString(EdmGeometryPolygon.getInstance(), input); + + final Polygon polygon = EdmGeographyPolygon.getInstance(). + valueOfString(input, null, null, null, null, null, Polygon.class); + assertNotNull(polygon); + assertEquals(0, polygon.getSrid(), 0); + Iterator itor = polygon.getInterior().iterator(); + assertEquals(1, itor.next().getX(), 0); + assertEquals(1, itor.next().getY(), 0); + itor = polygon.getExterior().iterator(); + itor.next(); + assertEquals(2, itor.next().getX(), 0); + assertEquals(3, itor.next().getY(), 0); + + assertEquals(input, EdmGeographyPolygon.getInstance().valueToString(polygon, null, null, null, null, null)); + } + + @Test + public void multiPolygon() throws EdmPrimitiveTypeException { + final String input = "geometry'SRID=0;MultiPolygon(" + + "((1.0 1.0,1.0 1.0),(1.0 1.0,2.0 2.0,3.0 3.0,1.0 1.0))," + + "((1.0 1.0,1.0 1.0),(1.0 1.0,2.0 2.0,3.0 3.0,1.0 1.0))" + + ")'"; + + expectContentErrorInValueOfString(EdmGeographyPolygon.getInstance(), input); + + final MultiPolygon multiPolygon = EdmGeometryMultiPolygon.getInstance(). + valueOfString(input, null, null, null, null, null, MultiPolygon.class); + assertNotNull(multiPolygon); + assertEquals(0, multiPolygon.getSrid(), 0); + final Iterator itor = multiPolygon.iterator(); + assertEquals(1, itor.next().getInterior().iterator().next().getX(), 0); + assertEquals(1, itor.next().getInterior().iterator().next().getX(), 0); + + assertEquals(input, EdmGeometryMultiPolygon.getInstance(). + valueToString(multiPolygon, null, null, null, null, null)); + + EdmGeographyMultiPolygon.getInstance().valueOfString( + "geography'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'", + null, null, null, null, null, MultiPolygon.class); + } + + @Test + public void collection() throws EdmPrimitiveTypeException { + final String input = "geometry'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'"; + + final GeospatialCollection collection = EdmGeometryCollection.getInstance(). + valueOfString(input, null, null, null, null, null, GeospatialCollection.class); + assertNotNull(collection); + assertEquals(0, collection.getSrid(), 0); + + final Geospatial item = collection.iterator().next(); + assertNotNull(item); + assertTrue(item instanceof LineString); + + assertEquals(input, EdmGeometryCollection.getInstance(). + valueToString(collection, null, null, null, null, null)); + } +} diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java index f69eddc18..ea63ea83e 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java @@ -28,7 +28,7 @@ import org.junit.Test; public class EdmGuidTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid); @Test public void toUriLiteral() { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java index 55c12bba0..b5844bcf8 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java @@ -29,13 +29,13 @@ import org.junit.Test; public class EdmInt16Test extends PrimitiveTypeBaseTest { - final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16); + final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16); @Test public void testInt16Compatibility() { assertTrue(instance.isCompatible(Uint7.getInstance())); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte))); } @Test diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java index e3410d742..1cb01e653 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java @@ -29,14 +29,14 @@ import org.junit.Test; public class EdmInt32Test extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32); @Test public void compatibility() { assertTrue(instance.isCompatible(Uint7.getInstance())); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16))); } @Test diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java index f45ab4949..eb08f3a88 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java @@ -29,15 +29,15 @@ import org.junit.Test; public class EdmInt64Test extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64); @Test public void compatibility() { assertTrue(instance.isCompatible(Uint7.getInstance())); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32))); } @Test diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java index 5450be841..706cd7f16 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java @@ -29,26 +29,22 @@ public class EdmNullTest extends PrimitiveTypeBaseTest { @Test public void checkNull() throws Exception { for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { - if (!kind.isGeospatial()) { - final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind); - assertNull(instance.valueToString(null, null, null, null, null, null)); - assertNull(instance.valueToString(null, true, null, null, null, null)); + final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind); + assertNull(instance.valueToString(null, null, null, null, null, null)); + assertNull(instance.valueToString(null, true, null, null, null, null)); - expectNullErrorInValueToString(instance); - } + expectNullErrorInValueToString(instance); } } @Test public void checkValueOfNull() throws Exception { for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { - if (!kind.isGeospatial()) { - final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind); - assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType())); - assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType())); + final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind); + assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType())); + assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType())); - expectNullErrorInValueOfString(instance); - } + expectNullErrorInValueOfString(instance); } } } diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java index 88835e928..69e9050fb 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java @@ -29,7 +29,7 @@ import org.junit.Test; public class EdmSByteTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte); @Test public void compatibility() { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java index 9e90f22ab..da6265487 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java @@ -30,16 +30,16 @@ import org.junit.Test; public class EdmSingleTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single); @Test public void compatibility() { assertTrue(instance.isCompatible(Uint7.getInstance())); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32))); - assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32))); + assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64))); } @Test diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java index bba0f910c..1cd698c7d 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java @@ -26,7 +26,7 @@ import org.junit.Test; public class EdmStringTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String); @Test public void toUriLiteral() throws Exception { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java index ee9b2b882..01f824f2f 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java @@ -29,7 +29,7 @@ import org.junit.Test; public class EdmTimeOfDayTest extends PrimitiveTypeBaseTest { - private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay); + private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay); @Test public void toUriLiteral() throws Exception { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java index c956789b3..0f1e83c99 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java @@ -30,6 +30,6 @@ public class UInt7Test extends PrimitiveTypeBaseTest { public void compatibility() { assertTrue(Uint7.getInstance().isCompatible(Uint7.getInstance())); assertFalse(Uint7.getInstance().isCompatible( - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String))); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String))); } } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java index 83d20fa31..7fce30b14 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java @@ -19,6 +19,8 @@ package org.apache.olingo.server.api; import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.server.api.serializer.ODataFormat; +import org.apache.olingo.server.api.serializer.ODataSerializer; public abstract class ODataServer { diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataFormat.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataFormat.java similarity index 94% rename from lib/server-api/src/main/java/org/apache/olingo/server/api/ODataFormat.java rename to lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataFormat.java index f3d4bf395..51425d88d 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataFormat.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataFormat.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.api; +package org.apache.olingo.server.api.serializer; public enum ODataFormat { XML, JSON diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java similarity index 86% rename from lib/server-api/src/main/java/org/apache/olingo/server/api/ODataSerializer.java rename to lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java index a6cfe5df3..e8a97d774 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataSerializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java @@ -16,16 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.api; +package org.apache.olingo.server.api.serializer; import java.io.InputStream; import org.apache.olingo.commons.api.edm.Edm; public interface ODataSerializer { - - InputStream metadata(Edm edm); + + public static final String DEFAULT_CHARSET = "UTF-8"; InputStream serviceDocument(Edm edm, String serviceRoot); + + InputStream metadataDocument(Edm edm); } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java index a634b2e0d..7beb90dad 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java @@ -19,21 +19,23 @@ package org.apache.olingo.server.core; import org.apache.olingo.commons.api.ODataRuntimeException; -import org.apache.olingo.server.api.ODataFormat; -import org.apache.olingo.server.api.ODataSerializer; import org.apache.olingo.server.api.ODataServer; +import org.apache.olingo.server.api.serializer.ODataFormat; +import org.apache.olingo.server.api.serializer.ODataSerializer; +import org.apache.olingo.server.core.serializer.ODataJsonSerializer; +import org.apache.olingo.server.core.serializer.ODataXmlSerializerImpl; public class ODataServerImpl extends ODataServer { @Override - public ODataSerializer getSerializer(ODataFormat format) { + public ODataSerializer getSerializer(final ODataFormat format) { ODataSerializer serializer; switch (format) { case JSON: serializer = new ODataJsonSerializer(); break; case XML: - serializer = new ODataSerializerImpl(); + serializer = new ODataXmlSerializerImpl(); break; default: throw new ODataRuntimeException("Unsupported format: " + format); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java index 511890be1..e96e16556 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java index 991d348d7..36eabb307 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.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. */ 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 9cbfa6865..78651bc86 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 @@ -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.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 navigationPropertyBindings; public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container, final BindingTarget target) { super(edm, container, target.getName(), target.getType()); @@ -46,8 +50,8 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget { final List navigationPropertyBindings = target.getNavigationPropertyBindings(); if (navigationPropertyBindings != null) { boolean found = false; - for (final Iterator itor = navigationPropertyBindings.iterator(); - itor.hasNext() && !found;) { + for (final Iterator itor = navigationPropertyBindings.iterator(); itor.hasNext() + && !found;) { final NavigationPropertyBinding binding = itor.next(); if (binding.getPath().equals(path)) { @@ -74,4 +78,24 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget { return bindingTarget; } + + @Override + public List getNavigationPropertyBindings() { + if (navigationPropertyBindings == null) { + List providerBindings = target.getNavigationPropertyBindings(); + navigationPropertyBindings = new ArrayList(); + 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; + } } 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 281bb6f26..c818c5804 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 @@ -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. */ @@ -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); instance.baseType = instance.buildBaseType(complexType.getBaseType()); @@ -43,7 +43,7 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType { private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) { super(edm, name, complexType.getBaseType()); - this.helper = new EdmStructuredTypeHelperImpl(edm, complexType); + helper = new EdmStructuredTypeHelperImpl(edm, complexType); } @Override 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 4199e083e..1a1012aef 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,16 +44,15 @@ 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(Edm edm, EdmProvider provider, FullQualifiedName containerFQN, - EntityContainer entityContainer) { - super(edm, containerFQN); + public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN, + final EntityContainer entityContainer) { + super(edm, containerFQN, entityContainer.getExtendsContainer()); this.provider = provider; - this.container = entityContainer; + container = entityContainer; } @Override @@ -186,7 +185,7 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { container = provider.getEntityContainer(); if (container == null) { // TODO: Should we throw an exception here? - container = new EntityContainer().setName(this.getName()); + container = new EntityContainer().setName(getName()); } } catch (ODataException e) { throw new EdmException(e); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java index 492095b78..680511719 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.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. */ 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 8bb8c2ddd..774af987b 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 @@ -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. */ @@ -38,14 +38,14 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType { private final EdmStructuredTypeHelper helper; public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName name, - final EntityType entityType) { + 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 key = entityType.getKey(); if (key != null) { final List edmKey = new ArrayList(); @@ -64,7 +64,7 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType { private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) { super(edm, name, entityType.getBaseType(), entityType.hasStream()); - this.helper = new EdmStructuredTypeHelperImpl(edm, entityType); + helper = new EdmStructuredTypeHelperImpl(edm, entityType); } @Override diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java index 9645d93f3..5a6011c91 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.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. */ @@ -40,9 +40,9 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType super(edm, enumName, enumType.isFlags()); if (enumType.getUnderlyingType() == null) { - this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32); + this.underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32); } else { - this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance( + this.underlyingType = EdmPrimitiveTypeFactory.getInstance( EdmPrimitiveTypeKind.valueOf(enumType.getUnderlyingType().getName())); // TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64? } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java index c03bbeaf9..f23e0a817 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java index 3b7cc0f16..0660ac0af 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.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. */ 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 58c0258f5..4c7e0cb23 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 @@ -1,34 +1,38 @@ -/* +/* * 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.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 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 getReferentialConstraints() { + if (referentialConstraints == null) { + final List providerConstraints = navigationProperty.getReferentialConstraints(); + referentialConstraints = new ArrayList(); + if (providerConstraints != null) { + for (ReferentialConstraint constraint : providerConstraints) { + referentialConstraints.add(new EdmReferentialConstraintImpl(constraint.getProperty(), constraint + .getReferencedProperty())); + } + } + } + return referentialConstraints; + } } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java index f2badd730..afb6d9616 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java @@ -25,7 +25,7 @@ import org.apache.olingo.server.api.edm.provider.OperationImport; public abstract class EdmOperationImportImpl extends AbstractEdmOperationImport { - public EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container, + public EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container, final OperationImport operationImport) { super(edm, container, operationImport.getName(), operationImport.getEntitySet()); } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java index d47b870fe..ce46b9ee2 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java index 20cafdf27..2fb494401 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java index 37ad8bd87..c810ba75e 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.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. */ 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 af98a41d0..34d34b401 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 @@ -46,7 +46,7 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl { private final Edm edm; private final EdmProvider provider; - public EdmSchemaImpl(Edm edm, EdmProvider provider, Schema schema) { + public EdmSchemaImpl(final Edm edm, final EdmProvider provider, final Schema schema) { super(schema.getNamespace(), schema.getAlias()); this.edm = edm; this.provider = provider; diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.java index 42ed8eeb9..ed6c7999f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.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. */ @@ -175,7 +175,7 @@ public class EdmServiceMetadataImpl implements EdmServiceMetadata { if (functionImports != null) { for (FunctionImport functionImport : functionImports) { functionImportInfos.add( - new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName())); + new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName())); } } } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java index 3ad9d13bd..6f9bb7845 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.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. */ 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 d2ded33cd..cc127694a 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 @@ -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. */ @@ -64,7 +64,7 @@ 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)); } } } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java index 91b0cde14..63172c68b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java @@ -45,7 +45,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements public EdmPrimitiveType getUnderlyingType() { if (edmPrimitiveTypeInstance == null) { try { - edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance( + edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance( EdmPrimitiveTypeKind.valueOf(typeDefinition.getUnderlyingType().getName())); } catch (IllegalArgumentException e) { throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataJsonSerializer.java new file mode 100644 index 000000000..333d5b70e --- /dev/null +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataJsonSerializer.java @@ -0,0 +1,87 @@ +/* + * 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.serializer; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; + +import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.server.api.serializer.ODataSerializer; +import org.apache.olingo.server.core.serializer.json.ServiceDocumentJsonSerializer; +import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; + +public class ODataJsonSerializer implements ODataSerializer { + + private static final Logger log = LoggerFactory.getLogger(ODataJsonSerializer.class); + + @Override + public InputStream serviceDocument(final Edm edm, final String serviceRoot) { + CircleStreamBuffer buffer; + BufferedWriter writer; + JsonFactory factory; + JsonGenerator gen = null; + + // TODO: move stream initialization into separate method + try { + buffer = new CircleStreamBuffer(); + writer = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET)); + factory = new JsonFactory(); + + gen = factory.createGenerator(writer); + gen.setPrettyPrinter(new DefaultPrettyPrinter()); + + ServiceDocumentJsonSerializer serializer = new ServiceDocumentJsonSerializer(edm, serviceRoot); + serializer.writeServiceDocument(gen); + + gen.close(); + + // TODO: Check correct stream handling + // writer.flush(); + // buffer.closeWrite(); + + return buffer.getInputStream(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new ODataRuntimeException(e); + } finally { + if (gen != null) { + try { + gen.close(); + } catch (IOException e) { + throw new ODataRuntimeException(e); + } + } + } + } + + @Override + public InputStream metadataDocument(final Edm edm) { + throw new ODataRuntimeException("Metadata in JSON format not supported!"); + } +} 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 new file mode 100644 index 000000000..49f88313a --- /dev/null +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java @@ -0,0 +1,72 @@ +/* + * 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.serializer; + +import java.io.InputStream; + +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.server.api.serializer.ODataSerializer; +import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer; +import org.apache.olingo.server.core.serializer.xml.MetadataDocumentXmlSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ODataXmlSerializerImpl implements ODataSerializer { + + private static final Logger log = LoggerFactory.getLogger(ODataXmlSerializerImpl.class); + + @Override + public InputStream serviceDocument(final Edm edm, final String serviceRoot) { + throw new ODataRuntimeException("Service Document not implemented for XML format"); + } + + @Override + public InputStream metadataDocument(final Edm edm) { + CircleStreamBuffer buffer; + XMLStreamWriter xmlStreamWriter = null; + + // TODO: move stream initialization into separate method + try { + buffer = new CircleStreamBuffer(); + xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET); + MetadataDocumentXmlSerializer serializer = new MetadataDocumentXmlSerializer(edm); + serializer.writeMetadataDocument(xmlStreamWriter); + xmlStreamWriter.close(); + + return buffer.getInputStream(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new ODataRuntimeException(e); + } finally { + if (xmlStreamWriter != null) { + try { + xmlStreamWriter.close(); + } catch (XMLStreamException e) { + throw new ODataRuntimeException(e); + } + } + } + } + +} diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java similarity index 56% rename from lib/server-core/src/main/java/org/apache/olingo/server/core/ODataJsonSerializer.java rename to lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java index 57a0d845e..827824bab 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataJsonSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java @@ -16,34 +16,20 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core; +package org.apache.olingo.server.core.serializer.json; -import java.io.BufferedWriter; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStreamWriter; -import org.apache.olingo.commons.api.ODataRuntimeException; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmEntityContainer; import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.edm.EdmFunctionImport; import org.apache.olingo.commons.api.edm.EdmSingleton; -import org.apache.olingo.server.api.ODataSerializer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; - -public class ODataJsonSerializer implements ODataSerializer { - - private static final Logger log = LoggerFactory.getLogger(ODataJsonSerializer.class); - - private static final String DEFAULT_CHARSET = "UTF-8"; +public class ServiceDocumentJsonSerializer { public static final String ODATA_CONTEXT = "@odata.context"; public static final String METADATA = "$metadata"; public static final String VALUE = "value"; @@ -55,58 +41,27 @@ public class ODataJsonSerializer implements ODataSerializer { public static final String SINGLETON = "Singleton"; public static final String SERVICE_DOCUMENT = "ServiceDocument"; - @Override - public InputStream metadata(Edm edm) { - throw new ODataRuntimeException("Metadata in JSON format not supported!"); + private final Edm edm; + private final String serviceRoot; + + public ServiceDocumentJsonSerializer(final Edm edm, final String serviceRoot) { + this.edm = edm; + this.serviceRoot = serviceRoot; } - @Override - public InputStream serviceDocument(Edm edm, String serviceRoot) { - CircleStreamBuffer buffer; - BufferedWriter writer; - JsonFactory factory; - JsonGenerator gen = null; + public void writeServiceDocument(final JsonGenerator gen) throws JsonGenerationException, IOException { + gen.writeStartObject(); - try { - buffer = new CircleStreamBuffer(); - writer = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET)); - factory = new JsonFactory(); - gen = factory.createGenerator(writer); + Object metadataUri = serviceRoot + "/" + METADATA; + gen.writeObjectField(ODATA_CONTEXT, metadataUri); + gen.writeArrayFieldStart(VALUE); - gen.setPrettyPrinter(new DefaultPrettyPrinter()); - - gen.writeStartObject(); - - Object metadataUri = serviceRoot + "/" + METADATA; - gen.writeObjectField(ODATA_CONTEXT, metadataUri); - gen.writeArrayFieldStart(VALUE); - - writeEntitySets(gen, edm); - writeFunctionImports(gen, edm); - writeSingletons(gen, edm); - - gen.close(); - -// writer.flush(); -// buffer.closeWrite(); - - return buffer.getInputStream(); - - } catch (Exception e) { - log.error(e.getMessage(), e); - throw new ODataRuntimeException(e); - } finally { - if (gen != null) { - try { - gen.close(); - } catch (IOException e) { - throw new ODataRuntimeException(e); - } - } - } + writeEntitySets(gen, edm); + writeFunctionImports(gen, edm); + writeSingletons(gen, edm); } - private void writeEntitySets(JsonGenerator gen, Edm edm) throws JsonGenerationException, IOException { + private void writeEntitySets(final JsonGenerator gen, final Edm edm) throws JsonGenerationException, IOException { EdmEntityContainer container = edm.getEntityContainer(null); for (EdmEntitySet edmEntitySet : container.getEntitySets()) { @@ -119,7 +74,8 @@ public class ODataJsonSerializer implements ODataSerializer { } } - private void writeFunctionImports(JsonGenerator gen, 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()) { @@ -133,7 +89,7 @@ public class ODataJsonSerializer implements ODataSerializer { } } - private void writeSingletons(JsonGenerator gen, Edm edm) throws JsonGenerationException, IOException { + private void writeSingletons(final JsonGenerator gen, final Edm edm) throws JsonGenerationException, IOException { EdmEntityContainer container = edm.getEntityContainer(null); for (EdmSingleton edmSingleton : container.getSingletons()) { diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/CircleStreamBuffer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java similarity index 99% rename from lib/server-core/src/main/java/org/apache/olingo/server/core/CircleStreamBuffer.java rename to lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java index 6784f8744..3bf8a7a8b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/CircleStreamBuffer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core; +package org.apache.olingo.server.core.serializer.utils; import java.io.IOException; import java.io.InputStream; 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 new file mode 100644 index 000000000..d83ad869d --- /dev/null +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java @@ -0,0 +1,543 @@ +/* + * 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.serializer.xml; + +import java.util.List; + +import javax.xml.stream.XMLStreamException; +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; +import org.apache.olingo.commons.api.edm.EdmEntityType; +import org.apache.olingo.commons.api.edm.EdmEnumType; +import org.apache.olingo.commons.api.edm.EdmFunction; +import org.apache.olingo.commons.api.edm.EdmFunctionImport; +import org.apache.olingo.commons.api.edm.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"; + private final static String PREFIX_EDMX = "edmx"; + private final static String NS_EDMX = "http://docs.oasis-open.org/odata/ns/edmx"; + + private final static String NS_EDM = "http://docs.oasis-open.org/odata/ns/edm"; + + public MetadataDocumentXmlSerializer(final Edm edm) { + this.edm = edm; + } + + public void writeMetadataDocument(final XMLStreamWriter writer) throws XMLStreamException { + writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0"); + writer.setPrefix(PREFIX_EDMX, NS_EDMX); + writer.setDefaultNamespace(NS_EDMX); + writer.writeStartElement(PREFIX_EDMX, EDMX, NS_EDMX); + writer.writeAttribute("Version", "4.0"); + writer.writeNamespace(PREFIX_EDMX, NS_EDMX); + + appendReference(writer); + appendDataServices(writer); + + writer.writeEndDocument(); + + } + + private void appendDataServices(final XMLStreamWriter writer) throws XMLStreamException { + writer.setDefaultNamespace(NS_EDM); + writer.writeStartElement(NS_EDMX, "DataServices"); + for (EdmSchema schema : edm.getSchemas()) { + appendSchema(writer, schema); + } + writer.writeEndElement(); + } + + private void appendSchema(final XMLStreamWriter writer, final EdmSchema schema) throws XMLStreamException { + writer.writeStartElement(NS_EDM, "Schema"); + writer.writeDefaultNamespace(NS_EDM); + writer.writeAttribute(XML_NAMESPACE, schema.getNamespace()); + writer.writeAttribute(XML_ALIAS, schema.getAlias()); + + // EnumTypes + appendEnumTypes(writer, schema.getEnumTypes()); + + // EntityTypes + appendEntityTypes(writer, schema.getEntityTypes()); + + // ComplexTypes + appendComplexTypes(writer, schema.getComplexTypes()); + + // TypeDefinitions + appendTypeDefinitions(writer, schema.getTypeDefinitions()); + + // Actions + appendActions(writer, schema.getActions()); + + // Functions + appendFunctions(writer, schema.getFunctions()); + + // EntityContainer + appendEntityContainer(writer, schema.getEntityContainer()); + + writer.writeEndElement(); + } + + private void appendTypeDefinitions(final XMLStreamWriter writer, final List 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(XML_ENTITY_CONTAINER); + + writer.writeAttribute(XML_NAME, container.getName()); + FullQualifiedName parentContainerName = container.getParentContainerName(); + if (parentContainerName != null) { + writer.writeAttribute(XML_EXTENDS, parentContainerName.getFullQualifiedNameAsString()); + } + + // EntitySets + appendEntitySets(writer, container.getEntitySets()); + + // Singletons + appendSingletons(writer, container.getSingletons()); + + // ActionImports + appendActionImports(writer, container.getActionImports()); + + // FunctionImports + appendFunctionImports(writer, container.getFunctionImports(), container.getNamespace()); + + writer.writeEndElement(); + } + } + + private void appendFunctionImports(final XMLStreamWriter writer, final List functionImports, + final String containerNamespace) throws XMLStreamException { + for (EdmFunctionImport functionImport : functionImports) { + 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(XML_ENTITY_SET, containerNamespace + "." + returnedEntitySet.getName()); + } + writer.writeAttribute(XML_INCLUDE_IN_SERVICE_DOCUMENT, "" + functionImport.isIncludeInServiceDocument()); + + // TODO: Annotations + writer.writeEndElement(); + } + } + + private void appendActionImports(final XMLStreamWriter writer, final List actionImports) + throws XMLStreamException { + for (EdmActionImport actionImport : actionImports) { + writer.writeStartElement(XML_ACTION_IMPORT); + writer.writeAttribute(XML_NAME, actionImport.getName()); + writer.writeAttribute(XML_ACTION, getFullQualifiedName(actionImport.getAction(), false)); + // TODO: Annotations + writer.writeEndElement(); + } + } + + private void appendSingletons(final XMLStreamWriter writer, final List singletons) + throws XMLStreamException { + for (EdmSingleton singleton : singletons) { + 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, final 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 entitySets) + throws XMLStreamException { + for (EdmEntitySet entitySet : entitySets) { + 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(); + } + } + + private void appendFunctions(final XMLStreamWriter writer, final List functions) + throws XMLStreamException { + for (EdmFunction function : functions) { + 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()); + + appendOperationParameters(writer, function); + + appendOperationReturnType(writer, function); + + writer.writeEndElement(); + } + } + + private void appendOperationReturnType(final XMLStreamWriter writer, final 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, final 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 actions) throws XMLStreamException { + for (EdmAction action : actions) { + writer.writeStartElement(XML_ACTION); + writer.writeAttribute(XML_NAME, action.getName()); + writer.writeAttribute(XML_IS_BOUND, "" + action.isBound()); + + appendOperationParameters(writer, action); + + appendOperationReturnType(writer, action); + + writer.writeEndElement(); + } + } + + private void appendReturnTypeFacets(final XMLStreamWriter writer, final 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(final XMLStreamWriter writer, final 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 complexTypes) + throws XMLStreamException { + for (EdmComplexType complexType : complexTypes) { + writer.writeStartElement(XML_COMPLEX_TYPE); + writer.writeAttribute(XML_NAME, complexType.getName()); + + if (complexType.getBaseType() != null) { + writer.writeAttribute(XML_BASE_TYPE, getFullQualifiedName(complexType.getBaseType(), false)); + } + + appendProperties(writer, complexType); + + appendNavigationProperties(writer, complexType); + + writer.writeEndElement(); + } + } + + private void appendEntityTypes(final XMLStreamWriter writer, final List entityTypes) + throws XMLStreamException { + for (EdmEntityType entityType : entityTypes) { + writer.writeStartElement(XML_ENTITY_TYPE); + writer.writeAttribute(XML_NAME, entityType.getName()); + + if (entityType.hasStream()) { + writer.writeAttribute(XML_HAS_STREAM, "" + entityType.hasStream()); + } + + if (entityType.getBaseType() != null) { + writer.writeAttribute(XML_BASE_TYPE, getFullQualifiedName(entityType.getBaseType(), false)); + } + + appendKey(writer, entityType); + + appendProperties(writer, entityType); + + appendNavigationProperties(writer, entityType); + + writer.writeEndElement(); + } + } + + private void appendNavigationProperties(final XMLStreamWriter writer, final EdmStructuredType type) + throws XMLStreamException { + List navigationPropertyNames = type.getNavigationPropertyNames(); + if (type.getBaseType() != null) { + navigationPropertyNames.removeAll(type.getBaseType().getNavigationPropertyNames()); + } + for (String navigationPropertyName : navigationPropertyNames) { + EdmNavigationProperty navigationProperty = type.getNavigationProperty(navigationPropertyName); + + 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(XML_NULLABLE, "" + navigationProperty.isNullable()); + } + + if (navigationProperty.getPartner() != null) { + EdmNavigationProperty partner = navigationProperty.getPartner(); + 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(); + } + } + + private void appendProperties(final XMLStreamWriter writer, final EdmStructuredType type) throws XMLStreamException { + List propertyNames = type.getPropertyNames(); + if (type.getBaseType() != null) { + propertyNames.removeAll(type.getBaseType().getPropertyNames()); + } + for (String propertyName : propertyNames) { + EdmProperty property = type.getStructuralProperty(propertyName); + 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(XML_NULLABLE, "" + property.isNullable()); + } + + if (property.isUnicode() != null) { + writer.writeAttribute(XML_UNICODE, "" + property.isUnicode()); + } + + if (property.getDefaultValue() != null) { + writer.writeAttribute(XML_DEFAULT_VALUE, property.getDefaultValue()); + } + + if (property.getMaxLength() != null) { + writer.writeAttribute(XML_MAX_LENGTH, "" + property.getMaxLength()); + } + + if (property.getPrecision() != null) { + writer.writeAttribute(XML_PRECISION, "" + property.getPrecision()); + } + + if (property.getScale() != null) { + writer.writeAttribute(XML_SCALE, "" + property.getScale()); + } + } + } + + private void appendKey(final XMLStreamWriter writer, final EdmEntityType entityType) throws XMLStreamException { + List keyPropertyRefs = entityType.getKeyPropertyRefs(); + if (keyPropertyRefs != null && !keyPropertyRefs.isEmpty()) { + // 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(XML_PROPERTY_REF); + String keyName = null; + if (keyRef.getPath() != null) { + keyName = keyRef.getPath() + "/" + keyRef.getKeyPropertyName(); + } else { + keyName = keyRef.getKeyPropertyName(); + } + writer.writeAttribute(XML_NAME, keyName); + + if (keyRef.getAlias() != null) { + writer.writeAttribute(XML_ALIAS, keyRef.getAlias()); + } + } + writer.writeEndElement(); + } + } + + private void appendEnumTypes(final XMLStreamWriter writer, final List enumTypes) + throws XMLStreamException { + for (EdmEnumType enumType : enumTypes) { + 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(XML_MEMBER); + writer.writeAttribute(XML_NAME, memberName); + writer.writeAttribute(XML_VALUE, enumType.getMember(memberName).getValue()); + } + + writer.writeEndElement(); + } + } + + private String getFullQualifiedName(final EdmType type, final boolean isCollection) { + if (isCollection) { + return "Collection(" + type.getNamespace() + "." + type.getName() + ")"; + } else { + return type.getNamespace() + "." + type.getName(); + } + } + + private void appendReference(final XMLStreamWriter writer) throws XMLStreamException { + writer.writeStartElement(NS_EDMX, "Reference"); + // TODO: Where is this value comming from? + 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(XML_NAMESPACE, "Org.OData.Core.V1"); + // TODO: Where is this value comming from? + writer.writeAttribute(XML_ALIAS, "Core"); + writer.writeEndElement(); + } +} diff --git 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 index a5ec95b8d..5992d9091 100644 --- 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,8 +278,8 @@ public class UriInfoImpl implements UriInfo { return this; } - public void removeResourcePart(int index) { - this.pathParts.remove(index); + public void removeResourcePart(final int index) { + pathParts.remove(index); } @Override diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java index b267a02f6..f195dd93c 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java index d14b7dfe1..8196d03d8 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java index d912d7a94..f7a8502ae 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java index 3e673f344..14f43ec9f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java index 032b43eeb..bf6d47b11 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java index abb80799a..6f23d23c4 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java index e43d30d70..9fbcbd013 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java index 94810bdfb..b28ddf895 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java index bb24c64de..caa8b6c2f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java index 1e3143c1b..1f5a953e2 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java index 062525abd..f71fe04e9 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java index a95228c37..3da7aef7b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java index 88600b3df..d599b9ba3 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java index d4abf660a..a0cdc3e3e 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java index 60df6b99e..0db0a0196 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java index 5854708b0..cc9c60667 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java index 6efe6a346..152f44cb2 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java index b7029fcff..d5f01eacf 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java index d366a901b..7611ecb2d 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java index b7500a8b2..42e0a0f31 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.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. */ 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 c7d13cdb5..957721a0f 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 @@ -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. */ @@ -45,15 +45,24 @@ public class UriContext { */ public Stack contextTypes; /** - * Set within method {@link #visitExpandItem(ExpandPathContext ctx)} and {@link #visitExpandPathExtension(final + * Set within method + * {@link #visitExpandItem(org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathContext ctx)} and {@link + * #visitExpandPathExtension(final * ExpandPathExtensionContext ctx)} to allow nodes - * deeper in the expand tree at {@link #visitExpandPathExtension(ExpandPathExtensionContext ctx)} appending path + * deeper in the expand tree at + * {@link + * #visitExpandPathExtension(org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext ctx)} + * appending path * segments to the currently processed {@link ExpandItemImpl}. */ public ExpandItemImpl contextExpandItemPath; /** - * Set within method {@link #visitSelectItem(SelectItemContext ctx)} to allow nodes - * deeper in the expand tree at {@link #visitSelectSegment(SelectSegmentContext ctx)} appending path segments to the + * Set within method + * {@link #visitSelectItem(org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectItemContext ctx)} to allow + * nodes + * deeper in the expand tree at + * {@link #visitSelectSegment(org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectSegmentContext ctx)} + * appending path segments to the * currently processed {@link SelectItemImpl}. */ public SelectItemImpl contextSelectItem; diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java index 47f5ccee5..1747c0c8e 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.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. */ @@ -204,8 +204,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { this.isCollection = isCollection; } - public TypeInformation() { - } + public TypeInformation() {} } public UriContext context = null; @@ -683,7 +682,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { return ret; } - private EdmType removeUriResourceStartingTypeFilterImpl(UriInfoImpl uriInfoImplpath) { + private EdmType removeUriResourceStartingTypeFilterImpl(final UriInfoImpl uriInfoImplpath) { List segments = uriInfoImplpath.getUriResourceParts(); if (segments.size() == 0) { @@ -878,10 +877,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { if (text.equals("false")) { return new LiteralImpl().setText("false").setType( - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean)); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean)); } return new LiteralImpl().setText("true").setType( - EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean)); + EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean)); } @Override @@ -1137,7 +1136,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { super.visitExpandPath(ctx); - EdmType startType = this.removeUriResourceStartingTypeFilterImpl(context.contextUriInfo); + EdmType startType = removeUriResourceStartingTypeFilterImpl(context.contextUriInfo); expandItem.setResourcePath(context.contextUriInfo); if (startType != null) { expandItem.setTypeFilter(startType); @@ -1551,7 +1550,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { @Override public Object visitNaninfinity(final NaninfinityContext ctx) { - return new LiteralImpl().setType(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal)). + return new LiteralImpl().setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)). setText(ctx.getText()); } @@ -1833,7 +1832,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource); uriInfo.addResourcePart(simple); - EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo); + EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo); if (startType != null) { context.contextSelectItem.setTypeFilter(startType); } @@ -1853,7 +1852,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource); uriInfo.addResourcePart(complex); - EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo); + EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo); if (startType != null) { context.contextSelectItem.setTypeFilter(startType); } @@ -1888,7 +1887,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource); uriInfo.addResourcePart(resourcePart); - EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo); + EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo); if (startType != null) { context.contextSelectItem.setTypeFilter(startType); } @@ -1907,7 +1906,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource); uriInfo.addResourcePart(resourcePart); - EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo); + EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo); if (startType != null) { context.contextSelectItem.setTypeFilter(startType); } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java index 6bc7ba9cf..adb5d01de 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java index c24a1947a..1dd952b6f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java index 9ef9abefc..da7f62cc8 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java index d61259acd..fd971a224 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CountOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CountOptionImpl.java index 0ec66443b..fa35d2ed9 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CountOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CountOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CustomQueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CustomQueryOptionImpl.java index 1197cf2fb..f5ae251c7 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CustomQueryOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CustomQueryOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java index cd4d18d79..12985eebf 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.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. */ @@ -161,15 +161,13 @@ public class ExpandItemImpl implements ExpandItem { return this; } - - - @Override + @Override public EdmType getStartTypeFilter() { - return this.startTypeFilter; + return startTypeFilter; } - public ExpandItemImpl setTypeFilter(EdmType startTypeFilter) { - this.startTypeFilter = startTypeFilter; - return this; + public ExpandItemImpl setTypeFilter(final EdmType startTypeFilter) { + this.startTypeFilter = startTypeFilter; + return this; } } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandOptionImpl.java index 9a08a3784..6cedc15a6 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FilterOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FilterOptionImpl.java index 816db6c00..8f0b0bea5 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FilterOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FilterOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FormatOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FormatOptionImpl.java index 7088602cd..a0baad713 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FormatOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FormatOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/IdOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/IdOptionImpl.java index ddc6d084c..f7df8250e 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/IdOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/IdOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/LevelsOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/LevelsOptionImpl.java index d02ab0042..dc17fdc7a 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/LevelsOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/LevelsOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByItemImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByItemImpl.java index a6c9cee78..aac33f0bb 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByItemImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByItemImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByOptionImpl.java index 3996c06a9..a278682c1 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionImpl.java index c2ba9d41b..1239cc659 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SearchOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SearchOptionImpl.java index add4cc6d1..130ef275e 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SearchOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SearchOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectItemImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectItemImpl.java index ac655d620..13d643626 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectItemImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectItemImpl.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. */ @@ -70,15 +70,15 @@ public class SelectItemImpl implements SelectItem { public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) { this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace; } - - @Override + + @Override public EdmType getStartTypeFilter() { - return this.startTypeFilter; + return startTypeFilter; } - public SelectItemImpl setTypeFilter(EdmType startTypeFilter) { - this.startTypeFilter = startTypeFilter; - return this; + public SelectItemImpl setTypeFilter(final EdmType startTypeFilter) { + this.startTypeFilter = startTypeFilter; + return this; } } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectOptionImpl.java index 5dbe9d3d3..b7ead9c62 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipOptionImpl.java index 796941083..84549e48f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipTokenOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipTokenOptionImpl.java index 6890244de..f65115cab 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipTokenOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipTokenOptionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SystemQueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SystemQueryOptionImpl.java index 24d1c48ba..99d94fdf5 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SystemQueryOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SystemQueryOptionImpl.java @@ -1,25 +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.server.core.uri.queryoption; -import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption; +import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; public class SystemQueryOptionImpl extends QueryOptionImpl implements SystemQueryOption { diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/TopOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/TopOptionImpl.java index 4085a29ab..aa33120b8 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/TopOptionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/TopOptionImpl.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. */ @@ -21,7 +21,6 @@ package org.apache.olingo.server.core.uri.queryoption; import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; import org.apache.olingo.server.api.uri.queryoption.TopOption; - public class TopOptionImpl extends SystemQueryOptionImpl implements TopOption { private int value; diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/AliasImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/AliasImpl.java index 03c7a0145..0c5770fa0 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/AliasImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/AliasImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/BinaryImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/BinaryImpl.java index ecd9dfc82..e583a53d3 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/BinaryImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/BinaryImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/EnumerationImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/EnumerationImpl.java index a356fc0fa..b565973d4 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/EnumerationImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/EnumerationImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionImpl.java index af04229f1..f1d3e9ebb 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LambdaRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LambdaRefImpl.java index f1fffe2b8..f90252d5b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LambdaRefImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LambdaRefImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LiteralImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LiteralImpl.java index 022b00b48..4d4009a5f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LiteralImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LiteralImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java index 18fc51963..5aba82fdb 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.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. */ @@ -85,15 +85,15 @@ public class MemberImpl extends ExpressionImpl implements Member, VisitableExres } return false; } - - @Override + + @Override public EdmType getStartTypeFilter() { - return this.startTypeFilter; + return startTypeFilter; } - public MemberImpl setTypeFilter(EdmType startTypeFilter) { - this.startTypeFilter = startTypeFilter; - return this; + public MemberImpl setTypeFilter(final EdmType startTypeFilter) { + this.startTypeFilter = startTypeFilter; + return this; } } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MethodImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MethodImpl.java index e06a3d0fb..0b8be21ae 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MethodImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MethodImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/TypeLiteralImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/TypeLiteralImpl.java index 9e5825f55..451cf0a04 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/TypeLiteralImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/TypeLiteralImpl.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. */ diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/UnaryImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/UnaryImpl.java index f782bb4e3..da4f5c624 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/UnaryImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/UnaryImpl.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java index c51dd7978..cb1d8d30b 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.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. */ @@ -41,8 +41,6 @@ import org.apache.olingo.server.api.edm.provider.Action; import org.apache.olingo.server.api.edm.provider.EntitySetPath; import org.apache.olingo.server.api.edm.provider.Parameter; import org.apache.olingo.server.api.edm.provider.ReturnType; -import org.apache.olingo.server.core.edm.provider.EdmActionImpl; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Before; import org.junit.Test; diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java index 97be017dd..f3963f6d6 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java @@ -32,8 +32,6 @@ import org.apache.olingo.commons.api.edm.EdmException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.edm.Target; import org.apache.olingo.server.api.edm.provider.ActionImport; -import org.apache.olingo.server.core.edm.provider.EdmActionImportImpl; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Before; import org.junit.Test; 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 366b73c7f..5db5e9890 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 @@ -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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java index d813a2731..70291e702 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.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. */ @@ -44,8 +44,6 @@ import org.apache.olingo.server.api.edm.provider.EntityContainerInfo; import org.apache.olingo.server.api.edm.provider.EntitySet; import org.apache.olingo.server.api.edm.provider.FunctionImport; import org.apache.olingo.server.api.edm.provider.Singleton; -import org.apache.olingo.server.core.edm.provider.EdmEntityContainerImpl; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Before; import org.junit.Test; @@ -61,107 +59,107 @@ public class EdmEntityContainerImplTest { new EntityContainerInfo().setContainerName(new FullQualifiedName("space", "name")); container = new EdmEntityContainerImpl(edm, provider, entityContainerInfo); } - + @Test - public void getAllEntitySetInitial(){ + public void getAllEntitySetInitial() { List entitySets = container.getEntitySets(); assertNotNull(entitySets); assertEquals(2, entitySets.size()); } - + @Test - public void getAllEntitySetsAfterOneWasAlreadyLoaded(){ + public void getAllEntitySetsAfterOneWasAlreadyLoaded() { EdmEntitySet entitySet = container.getEntitySet("entitySetName"); List entitySets = container.getEntitySets(); assertNotNull(entitySets); assertEquals(2, entitySets.size()); boolean contained = false; - for(EdmEntitySet es: entitySets){ - //Already loaded entity set must be the same - if(es.getName().equals("entitySetName")){ + for (EdmEntitySet es : entitySets) { + // Already loaded entity set must be the same + if (es.getName().equals("entitySetName")) { assertTrue(entitySet == es); contained = true; } } - if(!contained){ + if (!contained) { fail("Should have found entity set in this list."); } } - + @Test - public void getAllSingletonsInitial(){ + public void getAllSingletonsInitial() { List singletons = container.getSingletons(); assertNotNull(singletons); assertEquals(2, singletons.size()); } - + @Test - public void getAllSingletonsAfterOneWasAlreadyLoaded(){ + public void getAllSingletonsAfterOneWasAlreadyLoaded() { EdmSingleton singleton = container.getSingleton("singletonName"); List singletons = container.getSingletons(); assertNotNull(singletons); assertEquals(2, singletons.size()); boolean contained = false; - for(EdmSingleton s: singletons){ - //Already loaded singleton must be the same - if(s.getName().equals("singletonName")){ + for (EdmSingleton s : singletons) { + // Already loaded singleton must be the same + if (s.getName().equals("singletonName")) { assertTrue(singleton == s); contained = true; } } - if(!contained){ + if (!contained) { fail("Should have found singleton in this list."); } } - + @Test - public void getAllActionImportsInitial(){ + public void getAllActionImportsInitial() { List actionImports = container.getActionImports(); assertNotNull(actionImports); assertEquals(2, actionImports.size()); } - + @Test - public void getAllActionImportsAfterOneWasAlreadyLoaded(){ + public void getAllActionImportsAfterOneWasAlreadyLoaded() { EdmActionImport actionImport = container.getActionImport("actionImportName"); List actionImports = container.getActionImports(); assertNotNull(actionImports); assertEquals(2, actionImports.size()); boolean contained = false; - for(EdmActionImport ai: actionImports){ - //Already loaded action import must be the same - if(ai.getName().equals("actionImportName")){ + for (EdmActionImport ai : actionImports) { + // Already loaded action import must be the same + if (ai.getName().equals("actionImportName")) { assertTrue(actionImport == ai); contained = true; } } - if(!contained){ + if (!contained) { fail("Should have found action import in this list."); } } - + @Test - public void getAllFunctionImportsInitial(){ + public void getAllFunctionImportsInitial() { List functionImports = container.getFunctionImports(); assertNotNull(functionImports); assertEquals(2, functionImports.size()); } - + @Test - public void getAllFunctionImportsAfterOneWasAlreadyLoaded(){ + public void getAllFunctionImportsAfterOneWasAlreadyLoaded() { EdmFunctionImport functionImport = container.getFunctionImport("functionImportName"); List functionImports = container.getFunctionImports(); assertNotNull(functionImports); assertEquals(2, functionImports.size()); boolean contained = false; - for(EdmFunctionImport fi: functionImports){ - //Already loaded function import must be the same - if(fi.getName().equals("functionImportName")){ + for (EdmFunctionImport fi : functionImports) { + // Already loaded function import must be the same + if (fi.getName().equals("functionImportName")) { assertTrue(functionImport == fi); contained = true; } } - if(!contained){ + if (!contained) { fail("Should have found function import in this list."); } } @@ -311,30 +309,30 @@ public class EdmEntityContainerImplTest { } return null; } - + @Override public EntityContainer getEntityContainer() throws ODataException { EntityContainer container = new EntityContainer(); List entitySets = new ArrayList(); entitySets.add(new EntitySet().setName("entitySetName")); entitySets.add(new EntitySet().setName("entitySetName2")); - container.setEntitySets(entitySets ); - + container.setEntitySets(entitySets); + List singletons = new ArrayList(); singletons.add(new Singleton().setName("singletonName")); singletons.add(new Singleton().setName("singletonName2")); - container.setSingletons(singletons ); - + container.setSingletons(singletons); + List actionImports = new ArrayList(); actionImports.add(new ActionImport().setName("actionImportName")); actionImports.add(new ActionImport().setName("actionImportName2")); - container.setActionImports(actionImports ); - + container.setActionImports(actionImports); + List functionImports = new ArrayList(); functionImports.add(new FunctionImport().setName("functionImportName")); functionImports.add(new FunctionImport().setName("functionImportName2")); - container.setFunctionImports(functionImports ); - + container.setFunctionImports(functionImports); + return container; } } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java index 112b60a68..4ac609545 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.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. */ @@ -37,9 +37,6 @@ 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.NavigationPropertyBinding; import org.apache.olingo.server.api.edm.provider.PropertyRef; -import org.apache.olingo.server.core.edm.provider.EdmEntityContainerImpl; -import org.apache.olingo.server.core.edm.provider.EdmEntitySetImpl; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Test; public class EdmEntitySetImplTest { 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 9e4a947d9..eeb8313a5 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 @@ -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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java index e58edb7e1..9b5a5aee4 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.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. */ @@ -105,7 +105,7 @@ public class EdmEnumTest extends PrimitiveTypeBaseTest { @Test public void underlyingType() throws Exception { - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte), instance.getUnderlyingType()); + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte), instance.getUnderlyingType()); } @Test diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java index b45026105..50898470d 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.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. */ @@ -31,8 +31,6 @@ import org.apache.olingo.commons.api.edm.EdmReturnType; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.server.api.edm.provider.Function; import org.apache.olingo.server.api.edm.provider.ReturnType; -import org.apache.olingo.server.core.edm.provider.EdmFunctionImpl; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Before; import org.junit.Test; diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java index b77f7e9a9..8b8689c20 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.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. */ @@ -78,7 +78,7 @@ public class EdmFunctionImportImplTest { assertEquals(functionName.getName(), function.getName()); assertFalse(function.isBound()); assertFalse(function.isComposable()); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), function.getReturnType().getType()); assertEquals(entityContainer, functionImport.getEntityContainer()); assertNull(functionImport.getReturnedEntitySet()); diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java index adc0b30c9..e2950f3e3 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.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. */ @@ -32,7 +32,6 @@ import org.apache.olingo.commons.api.edm.EdmException; import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; import org.apache.olingo.commons.api.edm.EdmProperty; import org.apache.olingo.server.api.edm.provider.PropertyRef; -import org.apache.olingo.server.core.edm.provider.EdmKeyPropertyRefImpl; import org.junit.Test; public class EdmKeyPropertyRefImplTest { diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java index 8653edfc7..f0383f665 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java @@ -1,30 +1,28 @@ -/* +/* * 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.server.core.edm.provider; -import org.apache.olingo.commons.core.edm.EdmMemberImpl; - import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; +import org.apache.olingo.commons.core.edm.EdmMemberImpl; import org.apache.olingo.server.api.edm.provider.EnumMember; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Test; public class EdmMemberImplTest { diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNamedImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNamedImplTest.java index 164264ec2..946d660a8 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNamedImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNamedImplTest.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java index 30c83e9e5..dd3a8b57c 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.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. */ @@ -40,8 +40,6 @@ import org.apache.olingo.server.api.edm.provider.EntityType; import org.apache.olingo.server.api.edm.provider.NavigationProperty; import org.apache.olingo.server.api.edm.provider.PropertyRef; import org.apache.olingo.server.api.edm.provider.ReferentialConstraint; -import org.apache.olingo.server.core.edm.provider.EdmNavigationPropertyImpl; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Test; public class EdmNavigationPropertyImplTest { diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java index 52a377e23..b0acc7dfa 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java index 11d2d093b..e85a4d75c 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java index 7a7b43d68..1ac09ced4 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.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. */ @@ -39,7 +39,6 @@ import org.apache.olingo.server.api.edm.provider.Action; import org.apache.olingo.server.api.edm.provider.EdmProvider; import org.apache.olingo.server.api.edm.provider.Function; import org.apache.olingo.server.api.edm.provider.Parameter; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Before; import org.junit.Test; diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java index 4f5ed85a7..66a3f9909 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.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. */ @@ -47,7 +47,6 @@ import org.apache.olingo.server.api.edm.provider.EntityType; import org.apache.olingo.server.api.edm.provider.EnumType; import org.apache.olingo.server.api.edm.provider.PropertyRef; import org.apache.olingo.server.api.edm.provider.TypeDefinition; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.junit.Before; import org.junit.Test; diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java index bd028ba2e..bc010df10 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.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. */ @@ -46,7 +46,7 @@ public class EdmReturnTypeImplTest { EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), typeImpl.getType()); + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeImpl.getType()); assertFalse(typeImpl.isCollection()); assertNull(typeImpl.getPrecision()); @@ -61,7 +61,7 @@ public class EdmReturnTypeImplTest { EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), typeImpl.getType()); + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeImpl.getType()); assertTrue(typeImpl.isCollection()); } 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 2342eae13..f227796d9 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 @@ -73,7 +73,7 @@ public class EdmSchemaImplTest { schema = edm.getSchemas().get(0); } - + @Test public void initialSchemaTest() { EdmProvider provider = mock(EdmProvider.class); @@ -85,26 +85,26 @@ public class EdmSchemaImplTest { public void emptySchemaTest() throws Exception { ArrayList schemas = new ArrayList(); Schema providerSchema = new Schema(); - schemas.add(providerSchema ); + schemas.add(providerSchema); EdmProvider provider = mock(EdmProvider.class); when(provider.getSchemas()).thenReturn(schemas); edm = new EdmProviderImpl(provider); edm.getSchemas(); } - + @Test public void basicGetters() { assertEquals("namespace", schema.getNamespace()); assertEquals("alias", schema.getAlias()); } - + @Test - public void getTypeDefinitions(){ + public void getTypeDefinitions() { List typeDefinitions = schema.getTypeDefinitions(); assertNotNull(typeDefinitions); assertEquals(2, typeDefinitions.size()); - - for(EdmTypeDefinition def : typeDefinitions){ + + for (EdmTypeDefinition def : typeDefinitions) { assertTrue(def == edm.getTypeDefinition(new FullQualifiedName("namespace", def.getName()))); } } @@ -197,70 +197,84 @@ public class EdmSchemaImplTest { for (EdmFunctionImport obj : functionImports) { assertNotNull(obj.getFunctionFqn()); } - + assertTrue(container == edm.getEntityContainer(new FullQualifiedName(schema.getNamespace(), container.getName()))); assertTrue(container == edm.getEntityContainer(null)); } private class LocalProvider extends EdmProvider { + @Override public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public List getActions(final FullQualifiedName actionName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public List getFunctions(final FullQualifiedName functionName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public Term getTerm(final FullQualifiedName termName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public List getAliasInfos() throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } + @Override public List getSchemas() throws ODataException { Schema providerSchema = new Schema(); providerSchema.setNamespace("namespace"); @@ -300,7 +314,7 @@ public class EdmSchemaImplTest { typeDefinitions.add(new TypeDefinition().setName("typeDefinition1")); typeDefinitions.add(new TypeDefinition().setName("typeDefinition2")); providerSchema.setTypeDefinitions(typeDefinitions); - + List enumTypes = new ArrayList(); enumTypes.add(new EnumType().setName("enumType1")); enumTypes.add(new EnumType().setName("enumType2")); @@ -330,6 +344,7 @@ public class EdmSchemaImplTest { return schemas; } + @Override public EntityContainer getEntityContainer() throws ODataException { throw new RuntimeException("Provider must not be called in the schema case"); } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImplTest.java index 431c45844..16bc0fb53 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImplTest.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. */ @@ -39,7 +39,6 @@ import org.apache.olingo.server.api.edm.provider.EntitySet; import org.apache.olingo.server.api.edm.provider.FunctionImport; import org.apache.olingo.server.api.edm.provider.Schema; import org.apache.olingo.server.api.edm.provider.Singleton; -import org.apache.olingo.server.core.edm.provider.EdmServiceMetadataImpl; import org.junit.Test; public class EdmServiceMetadataImplTest { diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java index ab13215cd..10717d5d0 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.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. */ @@ -38,9 +38,6 @@ import org.apache.olingo.server.api.edm.provider.EntityType; import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding; import org.apache.olingo.server.api.edm.provider.PropertyRef; import org.apache.olingo.server.api.edm.provider.Singleton; -import org.apache.olingo.server.core.edm.provider.EdmEntityContainerImpl; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.edm.provider.EdmSingletonImpl; import org.junit.Test; public class EdmSingletonImplTest { diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java index 260e77a2d..f3a0559aa 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.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. */ @@ -47,7 +47,7 @@ public class EdmTypeDefinitionImplTest { assertEquals(String.class, typeDefImpl.getDefaultType()); assertEquals(EdmTypeKind.DEFINITION, typeDefImpl.getKind()); assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeDefImpl.getUnderlyingType()); - assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String))); + assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String))); // String validation assertEquals("'StringValue'", typeDefImpl.toUriLiteral("StringValue")); diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java index d932b1ef8..3da16bd56 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/ServiceDocumentTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java similarity index 96% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/ServiceDocumentTest.java rename to lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java index 8d08820e3..4bf5a9981 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/ServiceDocumentTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core; +package org.apache.olingo.server.core.serializer.json; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -33,9 +33,9 @@ import org.apache.olingo.commons.api.edm.EdmEntityContainer; import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.edm.EdmFunctionImport; import org.apache.olingo.commons.api.edm.EdmSingleton; -import org.apache.olingo.server.api.ODataFormat; -import org.apache.olingo.server.api.ODataSerializer; import org.apache.olingo.server.api.ODataServer; +import org.apache.olingo.server.api.serializer.ODataFormat; +import org.apache.olingo.server.api.serializer.ODataSerializer; import org.apache.olingo.server.core.testutil.StringUtils; import org.junit.Before; import org.junit.Test; 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 new file mode 100644 index 000000000..9d08914fb --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.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.server.core.serializer.xml; + +import static org.mockito.Mockito.mock; + +import java.io.InputStream; + +import org.apache.olingo.commons.api.ODataRuntimeException; +import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.server.api.ODataServer; +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; +import org.apache.olingo.server.core.testutil.StringUtils; +import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider; +import org.junit.Test; + +public class MetadataDocumentTest { + + @Test(expected = ODataRuntimeException.class) + public void metadataOnJsonResultsInException() { + ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.JSON); + serializer.metadataDocument(mock(Edm.class)); + } + + @Test + public void writeMetadataWithEmptyMockedEdm() { + ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML); + Edm edm = mock(Edm.class); + serializer.metadataDocument(edm); + } + + @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); + } +} 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 96afc8ee9..bee5f90bc 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 @@ -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. */ @@ -22,12 +22,14 @@ 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.server.api.edm.provider.ComplexType; 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.Property; import org.apache.olingo.server.api.edm.provider.PropertyRef; +import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider; /** * Implement the EdmTechProvider and @@ -37,6 +39,10 @@ import org.apache.olingo.server.api.edm.provider.PropertyRef; */ 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); @@ -64,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") diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/StringUtils.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/StringUtils.java index b7d8e2c29..8cabcf1bf 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/StringUtils.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/StringUtils.java @@ -25,7 +25,7 @@ import java.io.InputStreamReader; import java.nio.charset.Charset; public class StringUtils { - + public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) { try { final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8"))); @@ -48,5 +48,5 @@ public class StringUtils { throw new RuntimeException(e); } } - + } 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 new file mode 100644 index 000000000..f1748a726 --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java @@ -0,0 +1,191 @@ +/* + * 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 java.util.List; + +import org.apache.olingo.commons.api.ODataException; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.server.api.edm.provider.Action; +import org.apache.olingo.server.api.edm.provider.Parameter; +import org.apache.olingo.server.api.edm.provider.ReturnType; + +public class ActionProvider { + + // Bound Actions + public static final FullQualifiedName nameBAESAllPrimRTETAllPrim = + new FullQualifiedName(SchemaProvider.nameSpace, "BAESAllPrimRTETAllPrim"); + + public static final FullQualifiedName nameBAESTwoKeyNavRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BAESTwoKeyNavRTESTwoKeyNav"); + + public static final FullQualifiedName nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BAETBaseTwoKeyNavRTETBaseTwoKeyNav"); + + public static final FullQualifiedName nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav"); + + 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"); + + public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(SchemaProvider.nameSpace, + "UARTPrimParam"); + public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(SchemaProvider.nameSpace, + "UARTPrimCollParam"); + + public List getActions(final FullQualifiedName actionName) throws ODataException { + if (actionName.equals(nameUARTPrimParam)) { + return Arrays.asList( + new Action().setName("UARTPrimParam") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + + .setReturnType(new ReturnType().setType(PropertyProvider.nameString)) + ); + + } else if (actionName.equals(nameUARTPrimCollParam)) { + return Arrays.asList( + new Action().setName("UARTPrimCollParam") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + + .setReturnType( + new ReturnType().setType(PropertyProvider.nameString).setCollection(true)) + ); + + } else if (actionName.equals(nameUARTCompParam)) { + return Arrays.asList( + new Action().setName("UARTCompParam") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim)) + ); + + } else if (actionName.equals(nameUARTCompCollParam)) { + return Arrays.asList( + new Action().setName("UARTCompCollParam") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true)) + ); + + } else if (actionName.equals(nameUARTETParam)) { + return Arrays.asList( + new Action().setName("UARTETParam") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim)) + ); + + } else if (actionName.equals(nameUARTESParam)) { + return Arrays.asList( + new Action().setName("UARTESParam") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + .setReturnType( + 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) + .setNullable(false))) + .setBound(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) + , + new Action().setName("BAETTwoKeyNavRTETTwoKeyNav") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav) + .setNullable(false))) + .setBound(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) + ); + + } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) { + return Arrays.asList( + new Action().setName("BAESAllPrimRTETAllPrim") + .setParameters( + Arrays.asList( + new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim) + .setCollection(true).setNullable(false))) + .setBound(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETAllPrim)) + ); + + } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) { + return Arrays.asList( + new Action().setName("BAESTwoKeyNavRTESTwoKeyNav") + .setParameters( + Arrays.asList( + new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setBound(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + ); + + } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) { + return Arrays.asList( + new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setNullable(false))) + .setBound(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) + ); + + } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) { + return Arrays.asList( + new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav") + .setParameters( + Arrays.asList( + new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType( + EntityTypeProvider.nameETTwoBaseTwoKeyNav).setNullable(false))) + .setBound(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav)) + ); + } + + return null; + } +} 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 new file mode 100644 index 000000000..2db6d0e69 --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java @@ -0,0 +1,175 @@ +/* + * 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.FullQualifiedName; +import org.apache.olingo.server.api.edm.provider.ComplexType; +import org.apache.olingo.server.api.edm.provider.NavigationProperty; +import org.apache.olingo.server.api.edm.provider.Property; + +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 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 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"); + public static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(SchemaProvider.nameSpace, "CTTwoBase"); + public static final FullQualifiedName nameCTTwoBasePrimCompNav = + new FullQualifiedName(SchemaProvider.nameSpace, "CTTwoBasePrimCompNav"); + public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "CTTwoPrim"); + + public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { + + if (complexTypeName.equals(nameCTPrim)) { + return new ComplexType() + .setName("CTPrim") + .setProperties(Arrays.asList(PropertyProvider.propertyInt16)); + + } else if (complexTypeName.equals(nameCTAllPrim)) { + return new ComplexType() + .setName("CTAllPrim") + .setProperties( + Arrays.asList(PropertyProvider.propertyString, PropertyProvider.propertyBinary, + PropertyProvider.propertyBoolean, PropertyProvider.propertyByte, PropertyProvider.propertyDate, + PropertyProvider.propertyDateTimeOffset, PropertyProvider.propertyDecimal, + PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDuration, + PropertyProvider.propertyGuid, PropertyProvider.propertyInt16, PropertyProvider.propertyInt32, + PropertyProvider.propertyInt64, PropertyProvider.propertySByte, PropertyProvider.propertyTimeOfDay + /* TODO add propertyStream */)); + + } else if (complexTypeName.equals(nameCTCollAllPrim)) { + return new ComplexType() + .setName("CTCollAllPrim") + .setProperties( + Arrays.asList( + 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 collectionPropertyStream */)); + + } else if (complexTypeName.equals(nameCTTwoPrim)) { + return new ComplexType() + .setName("CTTwoPrim") + .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyString)); + + } else if (complexTypeName.equals(nameCTCompNav)) { + return new ComplexType() + .setName("CTCompNav") + .setProperties(Arrays.asList(PropertyProvider.propertyString, + PropertyProvider.propertyComplex_CTNavFiveProp)); + + } else if (complexTypeName.equals(nameCTMixPrimCollComp)) { + return new ComplexType() + .setName("CTMixPrimCollComp") + .setProperties( + Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.collPropertyString, + PropertyProvider.propertyComplex_CTTwoPrim, PropertyProvider.collPropertyComplex_CTTwoPrim)); + + } else if (complexTypeName.equals(nameCTBase)) { + return new ComplexType() + .setName("CTBase") + .setBaseType(nameCTTwoPrim) + .setProperties(Arrays.asList( + new Property() + .setName("AdditionalPropString") + .setType(new FullQualifiedName("Edm", "String")))); + + } else if (complexTypeName.equals(nameCTTwoBase)) { + return new ComplexType() + .setName("CTTwoBase") + .setBaseType(nameCTBase); + + } else if (complexTypeName.equals(nameCTCompComp)) { + return new ComplexType() + .setName("CTCompComp") + .setProperties(Arrays.asList(PropertyProvider.propertyComplex_CTTwoPrim)); + + } else if (complexTypeName.equals(nameCTCompCollComp)) { + return new ComplexType() + .setName("CTCompCollComp") + .setProperties(Arrays.asList(PropertyProvider.collPropertyComplex_CTTwoPrim)); + + } else if (complexTypeName.equals(nameCTPrimComp)) { + return new ComplexType() + .setName("CTPrimComp") + .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyComplex_CTAllPrim)); + + } else if (complexTypeName.equals(nameCTNavFiveProp)) { + return new ComplexType() + .setName("CTNavFiveProp") + .setProperties(Arrays.asList(PropertyProvider.propertyInt16)) + .setNavigationProperties((Arrays.asList( + PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav, + PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, + new NavigationProperty() + .setName("NavPropertyETMediaOne") + .setType(EntityTypeProvider.nameETMedia), + new NavigationProperty() + .setName("NavPropertyETMediaMany") + .setType(EntityTypeProvider.nameETMedia).setCollection(true) + ))); + + } else if (complexTypeName.equals(nameCTBasePrimCompNav)) { + return new ComplexType() + .setName("CTBasePrimCompNav") + .setBaseType(nameCTPrimComp) + .setNavigationProperties(Arrays.asList( + PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, + PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav, + PropertyProvider.navPropertyETKeyNavOne_ETKeyNav, + PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav)); + + } else if (complexTypeName.equals(nameCTPrimEnum)) { + return new ComplexType() + .setName("CTPrimEnum") + .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyEnumString_ENString)); + + } else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) { + return new ComplexType() + .setName("CTTwoBasePrimCompNav") + .setBaseType(nameCTBasePrimCompNav); + + } + + return null; + } + +} 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 new file mode 100644 index 000000000..5b923177a --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java @@ -0,0 +1,361 @@ +/* + * 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.FullQualifiedName; +import org.apache.olingo.commons.api.edm.Target; +import org.apache.olingo.server.api.edm.provider.ActionImport; +import org.apache.olingo.server.api.edm.provider.EntityContainer; +import org.apache.olingo.server.api.edm.provider.EntityContainerInfo; +import org.apache.olingo.server.api.edm.provider.EntitySet; +import org.apache.olingo.server.api.edm.provider.FunctionImport; +import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding; +import org.apache.olingo.server.api.edm.provider.Singleton; + +public class ContainerProvider { + + public static final FullQualifiedName nameContainer = new FullQualifiedName(SchemaProvider.nameSpace, "Container"); + + EntityContainerInfo entityContainerInfoTest1 = + new EntityContainerInfo().setContainerName(nameContainer); + + public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException { + if (entityContainerName == null) { + return entityContainerInfoTest1; + } else if (entityContainerName.equals(nameContainer)) { + return entityContainerInfoTest1; + } + + return null; + } + + public EntityContainer getEntityContainer() throws ODataException { + return null; + } + + public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException { + if (entityContainer == nameContainer) { + if (name.equals("ESAllPrim")) { + return new EntitySet() + .setName("ESAllPrim") + .setType(EntityTypeProvider.nameETAllPrim); + + } else if (name.equals("ESCollAllPrim")) { + return new EntitySet() + .setName("ESCollAllPrim") + .setType(EntityTypeProvider.nameETCollAllPrim); + + } else if (name.equals("ESTwoPrim")) { + return new EntitySet() + .setName("ESTwoPrim") + .setType(EntityTypeProvider.nameETTwoPrim); + + } else if (name.equals("ESMixPrimCollComp")) { + return new EntitySet() + .setName("ESMixPrimCollComp") + .setType(EntityTypeProvider.nameETMixPrimCollComp); + + } else if (name.equals("ESBase")) { + return new EntitySet() + .setName("ESBase") + .setType(EntityTypeProvider.nameETBase); + + } else if (name.equals("ESTwoBase")) { + return new EntitySet() + .setName("ESTwoBase") + .setType(EntityTypeProvider.nameETTwoBase); + + } else if (name.equals("ESTwoKeyTwoPrim")) { + return new EntitySet() + .setName("ESTwoKeyTwoPrim") + .setType(EntityTypeProvider.nameETTwoKeyTwoPrim); + + } else if (name.equals("ESBaseTwoKeyTwoPrim")) { + return new EntitySet() + .setName("ESBaseTwoKeyTwoPrim") + .setType(EntityTypeProvider.nameETBaseTwoKeyTwoPrim); + + } else if (name.equals("ESTwoBaseTwoKeyTwoPrim")) { + return new EntitySet() + .setName("ESTwoBaseTwoKeyTwoPrim") + .setType(EntityTypeProvider.nameETTwoBaseTwoKeyTwoPrim); + + } else if (name.equals("ESAllKey")) { + return new EntitySet() + .setName("ESAllKey") + .setType(EntityTypeProvider.nameETAllKey); + + } else if (name.equals("ESCompAllPrim")) { + return new EntitySet() + .setName("ESCompAllPrim") + .setType(EntityTypeProvider.nameETCompAllPrim); + + } else if (name.equals("ESCompCollAllPrim")) { + return new EntitySet() + .setName("ESCompCollAllPrim") + .setType(EntityTypeProvider.nameETCompCollAllPrim); + + } else if (name.equals("ESCompComp")) { + return new EntitySet() + .setName("ESCompComp") + .setType(EntityTypeProvider.nameETCompComp); + + } else if (name.equals("ESCompCollComp")) { + return new EntitySet() + .setName("ESCompCollComp") + .setType(EntityTypeProvider.nameETCompCollComp); + + } else if (name.equals("ESMedia")) { + return new EntitySet() + .setName("ESMedia") + .setType(EntityTypeProvider.nameETMedia) + .setIncludeInServiceDocument(true); + + } else if (name.equals("ESKeyTwoKeyComp")) { + return new EntitySet() + .setName("ESKeyTwoKeyComp") + .setType(EntityTypeProvider.nameETKeyTwoKeyComp); + + } else if (name.equals("ESInvisible")) { + return new EntitySet() + .setName("ESInvisible") + .setType(EntityTypeProvider.nameETAllPrim); + + } else if (name.equals("ESServerSidePaging")) { + return new EntitySet() + .setName("ESServerSidePaging") + .setType(EntityTypeProvider.nameETServerSidePaging); + + } else if (name.equals("ESAllNullable")) { + return new EntitySet() + .setName("ESAllNullable") + .setType(EntityTypeProvider.nameETAllNullable); + + } else if (name.equals("ESKeyNav")) { + return new EntitySet() + .setName("ESKeyNav") + .setType(EntityTypeProvider.nameETKeyNav); + + } else if (name.equals("ESTwoKeyNav")) { + return new EntitySet() + .setName("ESTwoKeyNav") + .setType(EntityTypeProvider.nameETTwoKeyNav); + + } else if (name.equals("ESBaseTwoKeyNav")) { + return new EntitySet() + .setName("ESBaseTwoKeyNav") + .setType(EntityTypeProvider.nameETBaseTwoKeyNav); + + } else if (name.equals("ESCompMixPrimCollComp")) { + return new EntitySet() + .setName("ESCompMixPrimCollComp") + .setType(EntityTypeProvider.nameETCompMixPrimCollComp); + + } else if (name.equals("ESFourKeyAlias")) { + return new EntitySet() + .setName("ESFourKeyAlias") + .setType(EntityTypeProvider.nameETFourKeyAlias); + } + } + + return null; + } + + public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name) throws ODataException + { + if (entityContainer.equals(nameContainer)) { + if (name.equals("AIRTPrimParam")) { + return new ActionImport() + .setName("AIRTPrimParam") + .setAction(ActionProvider.nameUARTPrimParam); + + } else if (name.equals("AIRTPrimCollParam")) { + return new ActionImport() + .setName("AIRTPrimCollParam") + .setAction(ActionProvider.nameUARTPrimCollParam); + + } else if (name.equals("AIRTCompParam")) { + return new ActionImport() + .setName("AIRTCompParam") + .setAction(ActionProvider.nameUARTCompParam); + + } else if (name.equals("AIRTCompCollParam")) { + return new ActionImport() + .setName("AIRTCompCollParam") + .setAction(ActionProvider.nameUARTCompCollParam); + + } else if (name.equals("AIRTETParam")) { + return new ActionImport() + .setName("AIRTETParam") + .setAction(ActionProvider.nameUARTETParam); + + } else if (name.equals("AIRTETCollAllPrimParam")) { + return new ActionImport() + .setName("AIRTETCollAllPrimParam") + .setAction(ActionProvider.nameUARTESParam); + } + } + + return null; + } + + public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String name) + throws ODataException { + + if (entityContainer.equals(nameContainer)) { + if (name.equals("FINRTInt16")) { + return new FunctionImport() + .setName("FINRTInt16") + .setFunction(FunctionProvider.nameUFNRTInt16) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FINInvisibleRTInt16")) { + return new FunctionImport() + .setName("FINInvisibleRTInt16") + .setFunction(FunctionProvider.nameUFNRTInt16); + + } else if (name.equals("FINInvisible2RTInt16")) { + return new FunctionImport() + .setName("FINInvisible2RTInt16") + .setFunction(FunctionProvider.nameUFNRTInt16); + + } else if (name.equals("FICRTETKeyNav")) { + return new FunctionImport() + .setName("FICRTETKeyNav") + .setFunction(FunctionProvider.nameUFCRTETKeyNav); + + } else if (name.equals("FICRTETTwoKeyNavParam")) { + return new FunctionImport() + .setName("FICRTETTwoKeyNavParam") + .setFunction(FunctionProvider.nameUFCRTETTwoKeyNavParam) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTStringTwoParam")) { + return new FunctionImport() + .setName("FICRTStringTwoParam") + .setFunction(FunctionProvider.nameUFCRTStringTwoParam) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTCollStringTwoParam")) { + return new FunctionImport() + .setName("FICRTCollStringTwoParam") + .setFunction(FunctionProvider.nameUFCRTCollStringTwoParam) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTCTAllPrimTwoParam")) { + return new FunctionImport() + .setName("FICRTCTAllPrimTwoParam") + .setFunction(FunctionProvider.nameUFCRTCTAllPrimTwoParam) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTESMixPrimCollCompTwoParam")) { + return new FunctionImport() + .setName("FICRTESMixPrimCollCompTwoParam") + .setFunction(FunctionProvider.nameUFCRTESMixPrimCollCompTwoParam) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FINRTESMixPrimCollCompTwoParam")) { + return new FunctionImport() + .setName("FINRTESMixPrimCollCompTwoParam") + .setFunction(FunctionProvider.nameUFNRTESMixPrimCollCompTwoParam) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTCollCTTwoPrim")) { + return new FunctionImport() + .setName("FICRTCollCTTwoPrim") + .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrim) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTETMedia")) { + return new FunctionImport() + .setName("FICRTETMedia") + .setFunction(FunctionProvider.nameUFCRTETMedia) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTCTTwoPrimParam")) { + return new FunctionImport() + .setName("FICRTCTTwoPrimParam") + .setFunction(FunctionProvider.nameUFCRTCTTwoPrimParam) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTCTTwoPrim")) { + return new FunctionImport() + .setName("FICRTCTTwoPrim") + .setFunction(FunctionProvider.nameUFCRTCTTwoPrim) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTCollString")) { + return new FunctionImport() + .setName("FICRTCollString") + .setFunction(FunctionProvider.nameUFCRTCollString) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTString")) { + return new FunctionImport() + .setName("FICRTString") + .setFunction(FunctionProvider.nameUFCRTString) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTESTwoKeyNavParam")) { + return new FunctionImport() + .setName("FICRTESTwoKeyNavParam") + .setFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam) + .setIncludeInServiceDocument(true); + + } else if (name.equals("FICRTCollCTTwoPrimParam")) { + return new FunctionImport() + .setName("FICRTCollCTTwoPrimParam") + .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrimParam) + .setIncludeInServiceDocument(true); + + } + } + + return null; + } + + public Singleton getSingleton(final FullQualifiedName entityContainer, final String name) throws ODataException { + if (entityContainer.equals(nameContainer)) { + + if (name.equals("SI")) { + return new Singleton() + .setName("SI") + .setType(EntityTypeProvider.nameETTwoPrim); + + } else if (name.equals("SINav")) { + return new Singleton() + .setName("SINav") + .setType(EntityTypeProvider.nameETTwoKeyNav) + .setNavigationPropertyBindings(Arrays.asList( + new NavigationPropertyBinding() + .setPath("NavPropertyETTwoKeyNavMany") + .setTarget(new Target().setTargetName("ESTwoKeyNav")))); + + } else if (name.equals("SIMedia")) { + return new Singleton() + .setName("SIMedia") + .setType(EntityTypeProvider.nameETMedia); + } + } + return null; + } +} 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 new file mode 100644 index 000000000..93e9c9dbf --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java @@ -0,0 +1,147 @@ +/* + * 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 java.util.List; + +import org.apache.olingo.commons.api.ODataException; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +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.AliasInfo; +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.EntityContainerInfo; +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.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.Schema; +import org.apache.olingo.server.api.edm.provider.Singleton; +import org.apache.olingo.server.api.edm.provider.Term; +import org.apache.olingo.server.api.edm.provider.TypeDefinition; + +public class EdmTechProvider extends EdmProvider { + + public static final String nameSpace = "com.sap.odata.test1"; + + private final SchemaProvider schemaProvider; + private final EntityTypeProvider entityTypeProvider; + private final ContainerProvider containerProvider; + private final ComplexTypeProvider complexTypeProvider; + private final EnumTypeProvider enumTypeProvider; + private final ActionProvider actionProvider; + private final FunctionProvider functionProvider; + private final TypeDefinitionProvider typeDefinitionProvider; + + public EdmTechProvider() { + containerProvider = new ContainerProvider(); + entityTypeProvider = new EntityTypeProvider(); + complexTypeProvider = new ComplexTypeProvider(); + enumTypeProvider = new EnumTypeProvider(); + actionProvider = new ActionProvider(); + functionProvider = new FunctionProvider(); + typeDefinitionProvider = new TypeDefinitionProvider(); + schemaProvider = new SchemaProvider(this); + } + + @Override + public List getAliasInfos() throws ODataException { + return Arrays.asList( + new AliasInfo().setAlias("Namespace1_Alias").setNamespace(nameSpace) + ); + } + + @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 getActions(final FullQualifiedName actionName) throws ODataException { + return actionProvider.getActions(actionName); + } + + @Override + public List 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 getSchemas() throws ODataException { + return schemaProvider.getSchemas(); + } + + @Override + public EntityContainer getEntityContainer() throws ODataException { + return containerProvider.getEntityContainer(); + } + + @Override + public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException { + return containerProvider.getEntityContainerInfo(entityContainerName); + } +} 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 new file mode 100644 index 000000000..291d893de --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java @@ -0,0 +1,410 @@ +/* + * 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.FullQualifiedName; +import org.apache.olingo.server.api.edm.provider.EntityType; +import org.apache.olingo.server.api.edm.provider.NavigationProperty; +import org.apache.olingo.server.api.edm.provider.Property; +import org.apache.olingo.server.api.edm.provider.PropertyRef; +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 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 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 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 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 nameETMedia = new FullQualifiedName(SchemaProvider.nameSpace, "ETMedia"); + 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"); + public static final FullQualifiedName nameETTwoBaseTwoKeyNav = + 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 nameETTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoPrim"); + + public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { + if (entityTypeName.equals(nameETAllPrim)) { + return new EntityType() + .setName("ETAllPrim") + .setKey(Arrays.asList( + new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties(Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, 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 */)) + .setNavigationProperties(Arrays.asList(PropertyProvider.navPropertyETTwoPrimOne_ETTwoPrim, + PropertyProvider.collectionNavPropertyETTwoPrimMany_ETTwoPrim)); + + } else if (entityTypeName.equals(nameETCollAllPrim)) { + return new EntityType() + .setName("ETCollAllPrim") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + + .setProperties( + Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, 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 */)); + + } else if (entityTypeName.equals(nameETTwoPrim)) { + return new EntityType() + .setName("ETTwoPrim") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties(Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString)) + .setNavigationProperties( + Arrays.asList(PropertyProvider.navPropertyETAllPrimOne_ETAllPrim, + PropertyProvider.collectionNavPropertyETAllPrimMany_ETAllPrim)); + + } else if (entityTypeName.equals(nameETMixPrimCollComp)) { + return new EntityType() + .setName("ETMixPrimCollComp") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties(Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.collPropertyString, + PropertyProvider.propertyComplex_CTTwoPrim, PropertyProvider.collPropertyComplex_CTTwoPrim)); + + } else if (entityTypeName.equals(nameETTwoKeyTwoPrim)) { + return new EntityType() + .setName("ETTwoKeyTwoPrim") + .setKey(Arrays.asList( + new PropertyRef().setPropertyName("PropertyInt16"), + new PropertyRef().setPropertyName("PropertyString"))) + .setProperties(Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString)); + + } else if (entityTypeName.equals(nameETBaseTwoKeyTwoPrim)) { + return new EntityType() + .setName("ETBaseTwoKeyTwoPrim") + .setBaseType(nameETTwoKeyTwoPrim); + + } else if (entityTypeName.equals(nameETTwoBaseTwoKeyTwoPrim)) { + return new EntityType() + .setName("ETTwoBaseTwoKeyTwoPrim") + .setBaseType(nameETTwoKeyTwoPrim); + + } else if (entityTypeName.equals(nameETBase)) { + return new EntityType() + .setName("ETBase") + .setBaseType(nameETTwoPrim) + .setProperties(Arrays.asList(new Property() + .setName("AdditionalPropertyString_5") + .setType(PropertyProvider.nameString))); + + } else if (entityTypeName.equals(nameETTwoBase)) { + return new EntityType() + .setName("ETTwoBase") + .setBaseType(nameETBase) + .setProperties(Arrays.asList(new Property() + .setName("AdditionalPropertyString_6") + .setType(PropertyProvider.nameString)) + ); + + } else if (entityTypeName.equals(nameETAllKey)) { + return new EntityType() + .setName("ETAllKey") + .setKey(Arrays.asList( + new PropertyRef().setPropertyName("PropertyString"), + new PropertyRef().setPropertyName("PropertyBoolean"), + new PropertyRef().setPropertyName("PropertyByte"), + new PropertyRef().setPropertyName("PropertySByte"), + new PropertyRef().setPropertyName("PropertyInt16"), + new PropertyRef().setPropertyName("PropertyInt32"), + new PropertyRef().setPropertyName("PropertyInt64"), + new PropertyRef().setPropertyName("PropertyDecimal"), + new PropertyRef().setPropertyName("PropertyDate"), + new PropertyRef().setPropertyName("PropertyDateTimeOffset"), + new PropertyRef().setPropertyName("PropertyDuration"), + new PropertyRef().setPropertyName("PropertyGuid"), + new PropertyRef().setPropertyName("PropertyTimeOfDay"))) + .setProperties( + Arrays.asList( + 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() + .setName("ETCompAllPrim") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties( + Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTAllPrim)); + + } else if (entityTypeName.equals(nameETCompCollAllPrim)) { + return new EntityType() + .setName("ETCompCollAllPrim") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + + .setProperties( + Arrays.asList(PropertyProvider.propertyInt16_NotNullable, + PropertyProvider.propertyComplex_CTCollAllPrim)); + + } else if (entityTypeName.equals(nameETCompComp)) { + return new EntityType() + .setName("ETCompComp") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties( + Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTCompComp)); + + } else if (entityTypeName.equals(nameETCompCollComp)) { + return new EntityType() + .setName("ETCompCollComp") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties( + Arrays + .asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTCompCollComp)); + + } else if (entityTypeName.equals(nameETMedia)) { + return new EntityType() + .setName("ETMedia") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable)) + .setHasStream(true); + + } else if (entityTypeName.equals(nameETKeyTwoKeyComp)) { + return new EntityType() + .setName("ETKeyTwoKeyComp") + .setKey(Arrays.asList( + new PropertyRef() + .setPropertyName("PropertyInt16"), + new PropertyRef() + .setPropertyName("PropertyComplex/PropertyInt16") + .setAlias("KeyAlias1"), + new PropertyRef() + .setPropertyName("PropertyComplex/PropertyString") + .setAlias("KeyAlias2"), + new PropertyRef() + .setPropertyName("PropertyComplexComplex/PropertyComplex/PropertyString") + .setAlias("KeyAlias3"))) + .setProperties( + Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTTwoPrim, + PropertyProvider.propertyComplexComplex_CTCompComp)); + + } else if (entityTypeName.equals(nameETServerSidePaging)) { + return new EntityType() + .setName(nameETServerSidePaging.getName()) + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable, + PropertyProvider.propertyString_NotNullable)); + + } else if (entityTypeName.equals(nameETAllNullable)) { + return new EntityType() + .setName("ETAllNullable") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyKey"))) + .setProperties( + Arrays.asList( + new Property() + .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() + .setName("ETKeyNav") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties( + Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable, + PropertyProvider.propertyComplex_CTNavFiveProp, + PropertyProvider.propertyComplexAllPrim_CTAllPrim, PropertyProvider.propertyComplexTwoPrim_CTTwoPrim, + PropertyProvider.collPropertyString, PropertyProvider.collPropertyInt16, + PropertyProvider.collPropertyComplex_CTPrimComp, + new Property() + .setName("PropertyComplexComplex").setType(ComplexTypeProvider.nameCTCompNav) + )) + .setNavigationProperties( + Arrays.asList( + PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav_NotNullable, + PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, + PropertyProvider.navPropertyETKeyNavOne_ETKeyNav, + PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav, + PropertyProvider.navPropertyETMediaOne_ETMedia, + PropertyProvider.collectionNavPropertyETMediaMany_ETMedia + )); + } else if (entityTypeName.equals(nameETKeyPrimNav)) { + return new EntityType() + .setName("ETKeyPrimNav") + .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) + .setProperties(Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_ExplicitNullable)) + .setNavigationProperties( + Arrays.asList( + PropertyProvider.navPropertyETKeyPrimNavOne_ETKeyPrimNav)); + + } else if (entityTypeName.equals(nameETTwoKeyNav)) { + return new EntityType() + .setName("ETTwoKeyNav") + .setKey(Arrays.asList( + new PropertyRef().setPropertyName("PropertyInt16"), + new PropertyRef().setPropertyName("PropertyString"))) + .setProperties( + Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable, + PropertyProvider.propertyComplex_CTPrimComp_NotNullable, + new Property().setName("PropertyComplexNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav) + .setNullable(false), + PropertyProvider.propertyComplexEnum_CTPrimEnum_NotNullable, + PropertyProvider.collPropertyComplex_CTPrimComp, + new Property().setName("CollPropertyComplexNav").setType(ComplexTypeProvider.nameCTNavFiveProp) + .setCollection(true), + PropertyProvider.collPropertyString, PropertyProvider.propertyComplexTwoPrim_CTTwoPrim, + PropertyProvider.propertyEnumString_ENString + )) + .setNavigationProperties(Arrays.asList( + new NavigationProperty() + .setName("NavPropertyETKeyNavOne") + .setType(nameETKeyNav) + .setReferentialConstraints(Arrays.asList( + new ReferentialConstraint() + .setProperty("PropertyInt16") + .setReferencedProperty("PropertyInt16"))), + PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav, + PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav, + PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav)); + + } else if (entityTypeName.equals(nameETBaseTwoKeyNav)) { + return new EntityType() + .setName("ETBaseTwoKeyNav") + .setBaseType(nameETTwoKeyNav) + .setProperties(Arrays.asList(PropertyProvider.propertyDate_ExplicitNullable)) + .setNavigationProperties(Arrays.asList( + new NavigationProperty() + .setName("NavPropertyETBaseTwoKeyNavOne") + .setType(nameETBaseTwoKeyNav), + new NavigationProperty() + .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_ExplicitNullable)) + .setNavigationProperties(Arrays.asList( + new NavigationProperty() + .setName("NavPropertyETBaseTwoKeyNavMany") + .setType(nameETBaseTwoKeyNav) + .setCollection(true) + )); + + } else if (entityTypeName.equals(nameETFourKeyAlias)) { + return new EntityType() + .setName("ETFourKeyAlias") + .setKey(Arrays.asList( + new PropertyRef() + .setPropertyName("PropertyInt16"), + new PropertyRef() + .setPropertyName("PropertyComplex/PropertyInt16").setAlias("KeyAlias1"), + new PropertyRef() + .setPropertyName("PropertyComplex/PropertyString").setAlias("KeyAlias2"), + new PropertyRef() + .setPropertyName("PropertyComplexComplex/PropertyComplex/PropertyString") + .setAlias("KeyAlias3"))) + .setProperties( + Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTTwoPrim, + PropertyProvider.propertyComplexComplex_CTCompComp)); + } else if (entityTypeName.equals(nameETCompMixPrimCollComp)) { + return new EntityType() + .setName("ETCompMixPrimCollComp") + .setKey(Arrays.asList( + new PropertyRef() + .setPropertyName("PropertyInt16"))) + .setProperties( + Arrays.asList(PropertyProvider.propertyInt16_NotNullable, + PropertyProvider.propertyMixedPrimCollComp_CTMixPrimCollComp)); + } + + return null; + } +} 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 new file mode 100644 index 000000000..94ea6ea78 --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.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.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.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; + } +} 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 new file mode 100644 index 000000000..fe6fefbec --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java @@ -0,0 +1,852 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.olingo.commons.api.ODataException; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.server.api.edm.provider.Function; +import org.apache.olingo.server.api.edm.provider.Parameter; +import org.apache.olingo.server.api.edm.provider.ReturnType; + +public class FunctionProvider { + + // Bound Functions + public static final FullQualifiedName nameBFCCollCTPrimCompRTESAllPrim = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCCollCTPrimCompRTESAllPrim"); + + public static final FullQualifiedName nameBFCCollStringRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCCollStringRTESTwoKeyNav"); + + public static final FullQualifiedName nameBFCCTPrimCompRTESBaseTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCCTPrimCompRTESBaseTwoKeyNav"); + + public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCCTPrimCompRTESTwoKeyNav"); + + public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNavParam = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCCTPrimCompRTESTwoKeyNavParam"); + + public static final FullQualifiedName nameBFCCTPrimCompRTETTwoKeyNavParam = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCCTPrimCompRTETTwoKeyNavParam"); + + public static final FullQualifiedName nameBFCESAllPrimRTCTAllPrim = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESAllPrimRTCTAllPrim"); + + public static final FullQualifiedName nameBFCESBaseTwoKeyNavRTESBaseTwoKey = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESBaseTwoKeyNavRTESBaseTwoKey"); + + public static final FullQualifiedName nameBFCESKeyNavRTETKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESKeyNavRTETKeyNav"); + + public static final FullQualifiedName nameBFCESKeyNavRTETKeyNavParam = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESKeyNavRTETKeyNavParam"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTTwoPrim = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESTwoKeyNavRTCollCTTwoPrim"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTCollString = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESTwoKeyNavRTCollString"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTCTTwoPrim = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESTwoKeyNavRTCTTwoPrim"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESTwoKeyNavRTESTwoKeyNav"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTString = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESTwoKeyNavRTString"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTStringParam = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESTwoKeyNavRTStringParam"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCESTwoKeyNavRTTwoKeyNav"); + + public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESBaseTwoKey = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCETBaseTwoKeyNavRTESBaseTwoKey"); + + public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCETBaseTwoKeyNavRTESTwoKeyNav"); + + public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTETTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCETBaseTwoKeyNavRTETTwoKeyNav"); + + public static final FullQualifiedName nameBFCETKeyNavRTETKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCETKeyNavRTETKeyNav"); + + public static final FullQualifiedName nameBFCETTwoKeyNavRTCTTwoPrim = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCETTwoKeyNavRTCTTwoPrim"); + + public static final FullQualifiedName nameBFCETTwoKeyNavRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCETTwoKeyNavRTESTwoKeyNav"); + + public static final FullQualifiedName nameBFCETTwoKeyNavRTETTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCETTwoKeyNavRTETTwoKeyNav"); + + public static final FullQualifiedName nameBFCSINavRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCSINavRTESTwoKeyNav"); + + public static final FullQualifiedName nameBFCStringRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFCStringRTESTwoKeyNav"); + + public static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "BFESTwoKeyNavRTESTwoKeyNav"); + + // 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 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 nameUFCRTCTTwoPrimParam = + new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCTTwoPrimParam"); + public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam = + new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTESMixPrimCollCompTwoParam"); + public static final FullQualifiedName nameUFCRTESTwoKeyNavParam = + 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 nameUFCRTETTwoKeyNavParam = + new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETTwoKeyNavParam"); + + public static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim = + new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETTwoKeyNavParamCTTwoPrim"); + + public static final FullQualifiedName nameUFCRTString = + new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTString"); + + public static final FullQualifiedName nameUFCRTStringTwoParam = + new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTStringTwoParam"); + + public static final FullQualifiedName nameUFNRTESMixPrimCollCompTwoParam = + new FullQualifiedName(SchemaProvider.nameSpace, "UFNRTESMixPrimCollCompTwoParam"); + 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 getFunctions(final FullQualifiedName functionName) throws ODataException { + + if (functionName.equals(nameUFNRTInt16)) { + return Arrays.asList( + new Function() + .setName("UFNRTInt16") + .setParameters(new ArrayList()) + .setReturnType( + new ReturnType().setType(PropertyProvider.nameInt16)) + ); + + } else if (functionName.equals(nameUFCRTETKeyNav)) { + return Arrays.asList( + new Function() + .setName("UFCRTETKeyNav") + .setParameters(new ArrayList()) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTETTwoKeyNavParam") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false) + ) + ); + + } else if (functionName.equals(nameUFCRTETTwoKeyNavParamCTTwoPrim)) { + return Arrays.asList( + new Function() + .setName("UFCRTETTwoKeyNavParamCTTwoPrim") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterCTTwoPrim").setType(ComplexTypeProvider.nameCTTwoPrim) + .setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false) + ) + ); + + } else if (functionName.equals(nameUFCRTStringTwoParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTStringTwoParam") + .setParameters(Arrays.asList( + new Parameter() + .setName("ParameterInt16") + .setType(PropertyProvider.nameInt16) + .setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(PropertyProvider.nameString).setNullable(false)), + new Function() + .setName("UFCRTStringTwoParam") + .setParameters(Arrays.asList( + 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).setNullable(false)) + + ); + + } else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTESTwoKeyNavParam") + .setParameters(Arrays.asList( + new Parameter() + .setName("ParameterInt16") + .setType(PropertyProvider.nameInt16) + .setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTString)) { + return Arrays.asList( + new Function() + .setName("UFCRTString") + + .setComposable(true) + .setParameters(new ArrayList()) + .setComposable(true) + .setReturnType( + new ReturnType().setType(PropertyProvider.nameString).setNullable(false) + ) + ); + + } else if (functionName.equals(nameUFCRTCollStringTwoParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTCollStringTwoParam") + .setParameters(Arrays.asList( + 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).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTCollString)) { + return Arrays.asList( + new Function() + .setName("UFCRTCollString") + .setParameters(new ArrayList()) + .setComposable(true) + .setReturnType( + new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTCTAllPrimTwoParam") + .setParameters(Arrays.asList( + 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).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTCTTwoPrimParam") + .setParameters(Arrays.asList( + 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).setNullable(false)) + ); + } else if (functionName.equals(nameUFCRTCollCTTwoPrimParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTCollCTTwoPrimParam") + .setParameters(Arrays.asList( + 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).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTCTTwoPrim)) { + return Arrays.asList( + new Function() + .setName("UFCRTCTTwoPrim") + .setParameters(new ArrayList()) + .setComposable(true) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) { + return Arrays.asList( + new Function() + .setName("UFCRTCollCTTwoPrim") + .setComposable(true) + .setParameters(new ArrayList()) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTETMedia)) { + return Arrays.asList( + new Function() + .setName("UFCRTETMedia") + .setParameters(new ArrayList()) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETMedia).setNullable(false)) + ); + + } else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) { + return Arrays.asList( + new Function() + .setName("UFNRTESMixPrimCollCompTwoParam") + .setParameters(Arrays.asList( + 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) + .setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTETAllPrimTwoParam") + .setParameters(Arrays.asList( + 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).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) { + return Arrays.asList( + new Function() + .setName("UFCRTESMixPrimCollCompTwoParam") + .setParameters(Arrays.asList( + 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) + .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( + new Function() + .setName("BFCESTwoKeyNavRTESTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true) + .setNullable(false)), + + new Function() + .setName("BFCESTwoKeyNavRTESTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false), + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString) + .setCollection(false).setNullable(false))) + .setComposable(true) + .setReturnType( + 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).setNullable(false))) + .setComposable(true) + .setReturnType( + 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).setNullable(false), + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString) + .setCollection(false).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true) + .setNullable(false)) + ); + + } else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) { + return Arrays.asList( + new Function().setName("BFCStringRTESTwoKeyNav") + .setBound(true) + .setParameters(Arrays.asList( + new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCETBaseTwoKeyNavRTETTwoKeyNav") + .setBound(true) + .setParameters(Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false) + ) + ); + + } else if (functionName.equals(nameBFCESBaseTwoKeyNavRTESBaseTwoKey)) { + return Arrays.asList( + new Function() + .setName("BFCESBaseTwoKeyNavRTESBaseTwoKey") + .setBound(true) + .setParameters(Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true) + .setNullable(false)) + ); + + } else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) { + return Arrays.asList( + new Function() + .setName("BFCESAllPrimRTCTAllPrim") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETAllPrim) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) { + return Arrays.asList( + new Function() + .setName("BFCESTwoKeyNavRTCTTwoPrim") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) { + return Arrays.asList( + new Function() + .setName("BFCESTwoKeyNavRTCollCTTwoPrim") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCESTwoKeyNavRTString)) { + return Arrays.asList( + new Function() + .setName("BFCESTwoKeyNavRTString") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(PropertyProvider.nameString).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) { + return Arrays.asList( + new Function() + .setName("BFCESTwoKeyNavRTCollString") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCETTwoKeyNavRTESTwoKeyNav") + .setBound(true) + .setParameters(Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCETBaseTwoKeyNavRTESTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCSINavRTESTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable( + false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) { + return Arrays.asList( + new Function() + .setName("BFCETBaseTwoKeyNavRTESBaseTwoKey") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true).setNullable( + false)) + ); + + } else if (functionName.equals(nameBFCCollStringRTESTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCCollStringRTESTwoKeyNav") + .setBound(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).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCCTPrimCompRTESTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable( + false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCCTPrimCompRTESBaseTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable( + false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true).setNullable( + false)) + ); + + } else if (functionName.equals(nameBFCCollCTPrimCompRTESAllPrim)) { + return Arrays.asList( + new Function() + .setName("BFCCollCTPrimCompRTESAllPrim") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCESTwoKeyNavRTTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) { + return Arrays + .asList( + new Function() + .setName("BFCESKeyNavRTETKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection( + true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCETKeyNavRTETKeyNav") + .setBound(true) + .setParameters(Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false)) + ); + } else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFESTwoKeyNavRTESTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) + + ); + + } else if (functionName.equals(nameBFCETTwoKeyNavRTETTwoKeyNav)) { + return Arrays.asList( + new Function() + .setName("BFCETTwoKeyNavRTETTwoKeyNav") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable( + false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) { + return Arrays.asList( + new Function() + .setName("BFCETTwoKeyNavRTCTTwoPrim") + .setBound(true) + .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.nameCTNavFiveProp).setCollection(true) + .setNullable(false)) + ); + } else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) { + return Arrays.asList( + new Function() + .setName("BFCESTwoKeyNavRTStringParam") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false), + new Parameter().setName("ParameterComplex").setType(ComplexTypeProvider.nameCTTwoPrim) + .setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(PropertyProvider.nameString).setNullable(false)) + ); + + } else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) { + return Arrays.asList( + new Function() + .setName("BFCESKeyNavRTETKeyNavParam") + .setBound(true) + .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).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).setNullable( + false), + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString) + .setNullable(false))) + .setComposable(true) + .setReturnType(new ReturnType() + .setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false) + ) + ); + } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNavParam)) { + return Arrays.asList( + new Function() + .setName("BFCCTPrimCompRTESTwoKeyNavParam") + .setBound(true) + .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).setNullable(false)) + ); + } + + return null; + } + +} 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 new file mode 100644 index 000000000..5d1ad3bb9 --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java @@ -0,0 +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.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 --------------------------------------------------------------------------------------- + +} 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 new file mode 100644 index 000000000..70d998794 --- /dev/null +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java @@ -0,0 +1,250 @@ +/* + * 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.ArrayList; +import java.util.List; + +import org.apache.olingo.commons.api.ODataException; +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.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.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.Schema; +import org.apache.olingo.server.api.edm.provider.Singleton; + +public class SchemaProvider { + + private EdmTechProvider prov; + + public static final String nameSpace = "com.sap.odata.test1"; + + public SchemaProvider(final EdmTechProvider prov) { + this.prov = prov; + } + + public List getSchemas() throws ODataException { + List schemas = new ArrayList(); + Schema schema = new Schema(); + schema.setNamespace("com.sap.odata.test1"); + schema.setAlias("Namespace1_Alias"); + schemas.add(schema); + // EnumTypes + List enumTypes = new ArrayList(); + schema.setEnumTypes(enumTypes); + enumTypes.add(prov.getEnumType(EnumTypeProvider.nameENString)); + // EntityTypes + List entityTypes = new ArrayList(); + schema.setEntityTypes(entityTypes); + + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAllPrim)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCollAllPrim)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoPrim)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMixPrimCollComp)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoKeyTwoPrim)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETBase)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoBase)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAllKey)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompAllPrim)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompCollAllPrim)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompComp)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompCollComp)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMedia)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETFourKeyAlias)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETServerSidePaging)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAllNullable)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETKeyNav)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoKeyNav)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoBaseTwoKeyNav)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompMixPrimCollComp)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETKeyPrimNav)); + + // ComplexTypes + List complexType = new ArrayList(); + schema.setComplexTypes(complexType); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTPrim)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTAllPrim)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCollAllPrim)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoPrim)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTMixPrimCollComp)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTBase)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoBase)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompComp)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompCollComp)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTPrimComp)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTNavFiveProp)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTPrimEnum)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTBasePrimCompNav)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoBasePrimCompNav)); + complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompNav)); + + // TypeDefinitions + + // Actions + List actions = new ArrayList(); + schema.setActions(actions); + 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 functions = new ArrayList(); + schema.setFunctions(functions); + + functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTInt16)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNavParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNavParamCTTwoPrim)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTStringTwoParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTESTwoKeyNavParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTString)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollStringTwoParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollString)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCTAllPrimTwoParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCTTwoPrimParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollCTTwoPrimParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCTTwoPrim)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollCTTwoPrim)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETMedia)); + 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)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESBaseTwoKeyNavRTESBaseTwoKey)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESAllPrimRTCTAllPrim)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCTTwoPrim)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCollCTTwoPrim)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTString)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCollString)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTESTwoKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETBaseTwoKeyNavRTESTwoKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCSINavRTESTwoKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETBaseTwoKeyNavRTESBaseTwoKey)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCollStringRTESTwoKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESBaseTwoKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCollCTPrimCompRTESAllPrim)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTTwoKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTETKeyNav)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETKeyNavRTETKeyNav)); + 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.nameBFCCTPrimCompRTESTwoKeyNavParam)); + + // EntityContainer + EntityContainer container = new EntityContainer(); + schema.setEntityContainer(container); + container.setName(ContainerProvider.nameContainer.getName()); + + // EntitySets + List entitySets = new ArrayList(); + container.setEntitySets(entitySets); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllPrim")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCollAllPrim")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoPrim")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixPrimCollComp")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBase")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoBase")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoKeyTwoPrim")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBaseTwoKeyTwoPrim")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoBaseTwoKeyTwoPrim")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllKey")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompAllPrim")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompCollAllPrim")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompComp")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompCollComp")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMedia")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESKeyTwoKeyComp")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESInvisible")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESServerSidePaging")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllNullable")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESKeyNav")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoKeyNav")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBaseTwoKeyNav")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompMixPrimCollComp")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESFourKeyAlias")); + + // Singletons + List singletons = new ArrayList(); + container.setSingletons(singletons); + singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SI")); + singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SINav")); + singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SIMedia")); + + // ActionImports + List actionImports = new ArrayList(); + container.setActionImports(actionImports); + actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, "AIRTPrimParam")); + actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, "AIRTPrimCollParam")); + actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, "AIRTCompParam")); + actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, "AIRTCompCollParam")); + actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, "AIRTETParam")); + actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, "AIRTETCollAllPrimParam")); + + // FunctionImports + List functionImports = new ArrayList(); + container.setFunctionImports(functionImports); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTInt16")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINInvisibleRTInt16")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINInvisible2RTInt16")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETKeyNav")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETTwoKeyNavParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTStringTwoParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollStringTwoParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTAllPrimTwoParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESMixPrimCollCompTwoParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTESMixPrimCollCompTwoParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrim")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETMedia")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTTwoPrimParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTTwoPrim")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollString")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTString")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESTwoKeyNavParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrimParam")); + + return schemas; + } + +} diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataSerializerImpl.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java similarity index 68% rename from lib/server-core/src/main/java/org/apache/olingo/server/core/ODataSerializerImpl.java rename to lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java index 3950e0c0d..dc34b316a 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataSerializerImpl.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java @@ -16,22 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.server.core; +package org.apache.olingo.server.core.testutil.techprovider; -import java.io.InputStream; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.server.api.edm.provider.TypeDefinition; -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.server.api.ODataSerializer; +public class TypeDefinitionProvider { -public class ODataSerializerImpl implements ODataSerializer { - - @Override - public InputStream metadata(Edm edm) { - return null; - } - - @Override - public InputStream serviceDocument(Edm edm, String serviceRoot) { + public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) { return null; } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java index f100eef5b..f54ad5799 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.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. */ @@ -122,21 +122,19 @@ public class RawUriTest { rawUri = runRawParser("nonServiceSegment/entitySet", 1); checkPath(rawUri, "nonServiceSegment/entitySet", Arrays.asList("entitySet")); - + rawUri = runRawParser("http://test.org/a?abc=xx+yz", 0); } - - @Test - public void testSplitt() { + @Test + public void testSplitt() { UriDecoder.splitt("", '/'); UriDecoder.splitt("/", '/'); UriDecoder.splitt("a", '/'); UriDecoder.splitt("a/", '/'); UriDecoder.splitt("/a", '/'); UriDecoder.splitt("a/a", '/'); - } - + } private void checkPath(final RawUri rawUri, final String path, final List list) { assertEquals(path, rawUri.path); diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java index 728d1873d..a9d516d8d 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.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. */ @@ -36,11 +36,8 @@ import org.apache.olingo.server.api.uri.UriInfoResource; import org.apache.olingo.server.api.uri.UriInfoService; import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechProvider; import org.apache.olingo.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.server.core.uri.UriInfoImpl; -import org.apache.olingo.server.core.uri.UriResourceActionImpl; -import org.apache.olingo.server.core.uri.UriResourceEntitySetImpl; +import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl; import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl; import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl; @@ -195,7 +192,7 @@ public class UriInfoImplTest { @Test public void testEntityTypeCast() { UriInfoImpl uriInfo = new UriInfoImpl(); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav); assertNotNull(entityType); uriInfo.setEntityTypeCast(entityType); diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java index f2408ff5c..7a5dc055c 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.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. */ @@ -41,8 +41,10 @@ import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl; import org.apache.olingo.server.core.edm.provider.EdmEntitySetImpl; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.server.core.edm.provider.EdmSingletonImpl; -import org.apache.olingo.server.core.testutil.EdmTechProvider; import org.apache.olingo.server.core.testutil.EdmTechTestProvider; +import org.apache.olingo.server.core.testutil.techprovider.ActionProvider; +import org.apache.olingo.server.core.testutil.techprovider.ComplexTypeProvider; +import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl; import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl; import org.junit.Test; @@ -74,10 +76,10 @@ public class UriResourceImplTest { assertEquals("", impl.toString()); // action - EdmAction action = edm.getAction(EdmTechProvider.nameUARTETParam, null, null); + EdmAction action = edm.getAction(ActionProvider.nameUARTETParam, null, null); impl.setAction(action); assertEquals(action, impl.getAction()); - assertEquals(EdmTechProvider.nameUARTETParam.getName(), impl.toString()); + assertEquals(ActionProvider.nameUARTETParam.getName(), impl.toString()); // action import impl = new UriResourceActionImpl(); @@ -102,7 +104,7 @@ public class UriResourceImplTest { assertEquals(false, impl.isCollection()); assertEquals(expression, impl.getExpression()); assertEquals("A", impl.getLambdaVariable()); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), impl.getType()); + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), impl.getType()); assertEquals("all", impl.toString()); } @@ -118,7 +120,7 @@ public class UriResourceImplTest { assertEquals(false, impl.isCollection()); assertEquals(expression, impl.getExpression()); assertEquals("A", impl.getLamdaVariable()); - assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), impl.getType()); + assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), impl.getType()); assertEquals("any", impl.toString()); } @@ -127,7 +129,7 @@ public class UriResourceImplTest { UriResourceComplexPropertyImpl impl = new UriResourceComplexPropertyImpl(); assertEquals(UriResourceKind.complexProperty, impl.getKind()); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav); EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComplex"); impl.setProperty(property); @@ -138,8 +140,8 @@ public class UriResourceImplTest { assertEquals(property.getType(), impl.getComplexType()); impl.getComplexType(); - EdmComplexTypeImpl complexTypeImplType - = (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav); + EdmComplexTypeImpl complexTypeImplType = + (EdmComplexTypeImpl) edm.getComplexType(ComplexTypeProvider.nameCTBasePrimCompNav); impl.setTypeFilter(complexTypeImplType); assertEquals(complexTypeImplType, impl.getTypeFilter()); @@ -153,7 +155,7 @@ public class UriResourceImplTest { UriResourcePrimitivePropertyImpl impl = new UriResourcePrimitivePropertyImpl(); assertEquals(UriResourceKind.primitiveProperty, impl.getKind()); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav); EdmProperty property = (EdmProperty) entityType.getProperty("PropertyInt16"); impl.setProperty(property); @@ -264,9 +266,9 @@ public class UriResourceImplTest { } Mock impl = new Mock(); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav); - EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); - EdmEntityType entityTypeBaseEntry = edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav); + EdmEntityType entityTypeBaseColl = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav); + EdmEntityType entityTypeBaseEntry = edm.getEntityType(EntityTypeProvider.nameETTwoBaseTwoKeyNav); impl.setType(entityType); assertEquals(entityType, impl.getType()); @@ -343,9 +345,9 @@ public class UriResourceImplTest { } Mock impl = new Mock(); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav); - EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); - edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav); + EdmEntityType entityTypeBaseColl = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav); + edm.getEntityType(EntityTypeProvider.nameETTwoBaseTwoKeyNav); impl.setType(entityType); assertEquals("mock", impl.toString()); @@ -365,7 +367,7 @@ public class UriResourceImplTest { UriResourceItImpl impl = new UriResourceItImpl(); assertEquals(UriResourceKind.it, impl.getKind()); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav); assertEquals("$it", impl.toString()); impl.setType(entityType); @@ -387,7 +389,7 @@ public class UriResourceImplTest { UriResourceNavigationPropertyImpl impl = new UriResourceNavigationPropertyImpl(); assertEquals(UriResourceKind.navigationProperty, impl.getKind()); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav); EdmNavigationProperty property = (EdmNavigationProperty) entityType.getProperty("NavPropertyETKeyNavMany"); assertNotNull(property); @@ -418,7 +420,7 @@ public class UriResourceImplTest { UriResourceRootImpl impl = new UriResourceRootImpl(); assertEquals(UriResourceKind.root, impl.getKind()); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav); assertEquals("$root", impl.toString()); impl.setType(entityType); @@ -441,7 +443,7 @@ public class UriResourceImplTest { assertEquals(UriResourceKind.singleton, impl.getKind()); EdmSingletonImpl singleton = (EdmSingletonImpl) edm.getEntityContainer(null).getSingleton("SINav"); - EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); + EdmEntityType entityTypeBaseColl = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav); impl.setSingleton(singleton); assertEquals("SINav", impl.toString()); @@ -470,7 +472,7 @@ public class UriResourceImplTest { UriResourceLambdaVarImpl impl = new UriResourceLambdaVarImpl(); assertEquals(UriResourceKind.lambdaVariable, impl.getKind()); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav); impl.setType(entityType); impl.setVariableText("A"); @@ -486,7 +488,7 @@ public class UriResourceImplTest { public void testUriResourceStartingTypeFilterImpl() { UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl(); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav); impl.setType(entityType); assertEquals("com.sap.odata.test1.ETTwoKeyNav", impl.toString()); diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java index 351fd54eb..ec78def5b 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java @@ -30,8 +30,11 @@ import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKin import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException; import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechProvider; import org.apache.olingo.server.core.testutil.EdmTechTestProvider; +import org.apache.olingo.server.core.testutil.techprovider.ComplexTypeProvider; +import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; +import org.apache.olingo.server.core.testutil.techprovider.EnumTypeProvider; +import org.apache.olingo.server.core.testutil.techprovider.PropertyProvider; import org.apache.olingo.server.core.uri.parser.UriParserException; import org.apache.olingo.server.core.uri.testutil.FilterValidator; import org.apache.olingo.server.core.uri.testutil.ResourceValidator; @@ -62,28 +65,28 @@ public class TestFullResourcePath { testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath() .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); // with string parameter testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath() .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); // with string parameter testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath() .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); } @Test @@ -94,13 +97,13 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, false) + .isType(ComplexTypeProvider.nameCTPrimComp, false) .n() .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav"); @@ -109,16 +112,16 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, false) + .isType(ComplexTypeProvider.nameCTPrimComp, false) .n() .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav") - .isType(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isUriPathInfoKind(UriResourceKind.count); @@ -134,7 +137,7 @@ public class TestFullResourcePath { .n() .isUriPathInfoKind(UriResourceKind.complexProperty) .isComplex("CollPropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, true) + .isType(ComplexTypeProvider.nameCTPrimComp, true) .n() .isFunction("BFCCollCTPrimCompRTESAllPrim"); @@ -147,10 +150,10 @@ public class TestFullResourcePath { .n() .isUriPathInfoKind(UriResourceKind.complexProperty) .isComplex("CollPropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, true) + .isType(ComplexTypeProvider.nameCTPrimComp, true) .n() .isFunction("BFCCollCTPrimCompRTESAllPrim") - .isType(EdmTechProvider.nameETAllPrim, true) + .isType(EntityTypeProvider.nameETAllPrim, true) .n() .isUriPathInfoKind(UriResourceKind.count); } @@ -167,7 +170,7 @@ public class TestFullResourcePath { .n() .isUriPathInfoKind(UriResourceKind.complexProperty) .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, false) + .isType(ComplexTypeProvider.nameCTPrimComp, false) .n() .isFunction("BFCCTPrimCompRTESTwoKeyNav"); @@ -181,10 +184,10 @@ public class TestFullResourcePath { .n() .isUriPathInfoKind(UriResourceKind.complexProperty) .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, false) + .isType(ComplexTypeProvider.nameCTPrimComp, false) .n() .isFunction("BFCCTPrimCompRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .n() .isUriPathInfoKind(UriResourceKind.count); @@ -210,10 +213,10 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav"); @@ -223,8 +226,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'(''2'')'") .n() @@ -238,8 +241,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, true) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey"); @@ -249,12 +252,12 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, true) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey") - .isType(EdmTechProvider.nameETBaseTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav); + .isType(EntityTypeProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav); testUri.run("ESTwoKeyNav" + "/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()" @@ -265,11 +268,11 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav); + .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav); } @Test @@ -280,7 +283,7 @@ public class TestFullResourcePath { .isEntitySet("ESAllPrim") .n() .isFunction("BFCESAllPrimRTCTAllPrim") - .isType(EdmTechProvider.nameCTAllPrim); + .isType(ComplexTypeProvider.nameCTAllPrim); testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/com.sap.odata.test1.CTBase") .isKind(UriInfoKind.resource).goPath() @@ -288,8 +291,8 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTCTTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim, false) - .isTypeFilterOnEntry(EdmTechProvider.nameCTBase); + .isType(ComplexTypeProvider.nameCTTwoPrim, false) + .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase); } @Test @@ -300,7 +303,7 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim, true); + .isType(ComplexTypeProvider.nameCTTwoPrim, true); testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count") .isKind(UriInfoKind.resource).goPath() @@ -308,7 +311,7 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim, true) + .isType(ComplexTypeProvider.nameCTTwoPrim, true) .n() .isUriPathInfoKind(UriResourceKind.count); } @@ -322,7 +325,7 @@ public class TestFullResourcePath { .n() .isFunction("BFCESTwoKeyNavRTTwoKeyNav") .n() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false); + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false); testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref") .isKind(UriInfoKind.resource).goPath() @@ -331,7 +334,7 @@ public class TestFullResourcePath { .n() .isFunction("BFCESTwoKeyNavRTTwoKeyNav") .n() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) .n() .isUriPathInfoKind(UriResourceKind.ref); @@ -342,7 +345,7 @@ public class TestFullResourcePath { .n() .isFunction("BFCESKeyNavRTETKeyNav") .n() - .isNavProperty("NavPropertyETMediaOne", EdmTechProvider.nameETMedia, false) + .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false) .n() .isValue(); @@ -355,7 +358,7 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNavParam") .isParameter(0, "ParameterString", "'1'") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false); + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" + "/NavPropertyETTwoKeyNavOne/PropertyComplex") @@ -366,10 +369,10 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNavParam") .isParameter(0, "ParameterString", "'1'") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) .n() .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp); + .isType(ComplexTypeProvider.nameCTPrimComp); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" + "/NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex") @@ -380,13 +383,13 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNavParam") .isParameter(0, "ParameterString", "'1'") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) .n() .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp) + .isType(ComplexTypeProvider.nameCTPrimComp) .n() .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTAllPrim); + .isType(ComplexTypeProvider.nameCTAllPrim); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" + "/NavPropertyETTwoKeyNavOne/PropertyString") @@ -397,9 +400,9 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNavParam") .isParameter(0, "ParameterString", "'1'") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/PropertyString") @@ -410,11 +413,11 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNavParam") .isParameter(0, "ParameterString", "'1'") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); } @Test @@ -427,9 +430,9 @@ public class TestFullResourcePath { .n() .isFunction("BFCESTwoKeyNavRTTwoKeyNav") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav); + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav); testUri .run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')" @@ -439,13 +442,13 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav); + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav); } @@ -460,7 +463,7 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNav") .n() .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTNavFiveProp); + .isType(ComplexTypeProvider.nameCTNavFiveProp); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16") .isKind(UriInfoKind.resource).goPath() @@ -470,9 +473,9 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNav") .n() .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTNavFiveProp) + .isType(ComplexTypeProvider.nameCTNavFiveProp) .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16/$value") .isKind(UriInfoKind.resource).goPath() @@ -482,9 +485,9 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNav") .n() .isComplex("PropertyComplex") - .isType(EdmTechProvider.nameCTNavFiveProp) + .isType(ComplexTypeProvider.nameCTNavFiveProp) .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .n() .isValue(); @@ -503,8 +506,8 @@ public class TestFullResourcePath { .isParameter(0, "ParameterString", "'1'") .n() .isComplex("PropertyComplexTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim) - .isTypeFilter(EdmTechProvider.nameCTTwoBase); + .isType(ComplexTypeProvider.nameCTTwoPrim) + .isTypeFilter(ComplexTypeProvider.nameCTTwoBase); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')" @@ -516,13 +519,13 @@ public class TestFullResourcePath { .isFunction("BFCESKeyNavRTETKeyNavParam") .isParameter(0, "ParameterString", "'1'") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() .isComplex("PropertyComplexTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim) - .isTypeFilter(EdmTechProvider.nameCTTwoBase); + .isType(ComplexTypeProvider.nameCTTwoPrim) + .isTypeFilter(ComplexTypeProvider.nameCTTwoBase); } @Test @@ -534,7 +537,7 @@ public class TestFullResourcePath { .n() .isFunction("BFCESKeyNavRTETKeyNav") .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value") .isKind(UriInfoKind.resource).goPath() @@ -543,7 +546,7 @@ public class TestFullResourcePath { .n() .isFunction("BFCESKeyNavRTETKeyNav") .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .n() .isValue(); @@ -558,7 +561,7 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')") .isKind(UriInfoKind.resource).goPath() @@ -567,7 +570,7 @@ public class TestFullResourcePath { .n() .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") .isParameter(0, "ParameterString", "'2'") - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()") .isKind(UriInfoKind.resource).goPath() @@ -575,7 +578,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .n() .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')") .isKind(UriInfoKind.resource).goPath() @@ -584,7 +587,7 @@ public class TestFullResourcePath { .n() .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") .isParameter(0, "ParameterString", "'3'") - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count") .isKind(UriInfoKind.resource).goPath() @@ -592,7 +595,7 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .n() .isCount(); @@ -618,7 +621,7 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .n() .isComplex("CollPropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp) + .isType(ComplexTypeProvider.nameCTPrimComp) .n() .isFunction("BFCCollCTPrimCompRTESAllPrim") .n() @@ -641,7 +644,7 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTString") - .isType(EdmTechProvider.nameString) + .isType(PropertyProvider.nameString) .n() .isValue(); } @@ -654,7 +657,7 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTCollString") - .isType(EdmTechProvider.nameString, true); + .isType(PropertyProvider.nameString, true); testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()/$count") .isKind(UriInfoKind.resource).goPath() @@ -662,7 +665,7 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .n() .isFunction("BFCESTwoKeyNavRTCollString") - .isType(EdmTechProvider.nameString, true) + .isType(PropertyProvider.nameString, true) .n() .isCount(); } @@ -675,10 +678,10 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true) + .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true) .n() .isFunction("BFCCollStringRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, true); + .isType(EntityTypeProvider.nameETTwoKeyNav, true); testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()/$count") .isKind(UriInfoKind.resource).goPath() @@ -686,10 +689,10 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true) + .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true) .n() .isFunction("BFCCollStringRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .n() .isCount(); } @@ -703,10 +706,10 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .n() .isFunction("BFCStringRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, true); + .isType(EntityTypeProvider.nameETTwoKeyNav, true); testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$count") .isKind(UriInfoKind.resource).goPath() @@ -714,10 +717,10 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .n() .isFunction("BFCStringRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .n() .isCount(); @@ -727,10 +730,10 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .n() .isFunction("BFCStringRTESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .n() .isRef(); } @@ -742,7 +745,7 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .n() .isFunction("BFCSINavRTESTwoKeyNav"); } @@ -753,8 +756,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey"); } @@ -798,20 +801,20 @@ public class TestFullResourcePath { .goPath() .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETAllPrim, false) + .isType(EntityTypeProvider.nameETAllPrim, false) .at(1) .isUriPathInfoKind(UriResourceKind.primitiveProperty) - .isType(EdmTechProvider.nameString); + .isType(PropertyProvider.nameString); // on collection of primitive testUri.run("ESCollAllPrim(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()") .goPath() .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETCollAllPrim, false) + .isType(EntityTypeProvider.nameETCollAllPrim, false) .at(1) .isUriPathInfoKind(UriResourceKind.primitiveProperty) - .isType(EdmTechProvider.nameString); + .isType(PropertyProvider.nameString); // on complex testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')" @@ -819,11 +822,11 @@ public class TestFullResourcePath { .goPath() .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .at(1) .isUriPathInfoKind(UriResourceKind.complexProperty) .at(2) - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); // on collection of complex testUri.run("ESKeyNav(1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()") @@ -831,10 +834,10 @@ public class TestFullResourcePath { .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) .at(1) - .isType(EdmTechProvider.nameCTPrimComp, true) + .isType(ComplexTypeProvider.nameCTPrimComp, true) .at(2) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameETAllPrim); + .isType(EntityTypeProvider.nameETAllPrim); // on entity testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')" @@ -842,19 +845,19 @@ public class TestFullResourcePath { .goPath() .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); // on collection of entity testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()") .goPath() .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .at(1).isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); } @Test @@ -867,7 +870,7 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isAction("BAETBaseTwoKeyNavRTETBaseTwoKeyNav"); @@ -876,10 +879,10 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav) .n() .isAction("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav"); } @@ -910,7 +913,7 @@ public class TestFullResourcePath { .isIdText("ESKeyNav(1)"); testUri.run("$entity/com.sap.odata.test1.ETKeyNav?$id=ESKeyNav(1)") .isKind(UriInfoKind.entityId) - .isEntityType(EdmTechProvider.nameETKeyNav) + .isEntityType(EntityTypeProvider.nameETKeyNav) .isIdText("ESKeyNav(1)"); } @@ -929,13 +932,13 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESAllPrim") - .isType(EdmTechProvider.nameETAllPrim, true); + .isType(EntityTypeProvider.nameETAllPrim, true); testUri.run("ESAllPrim/$count") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESAllPrim") - .isType(EdmTechProvider.nameETAllPrim, true) + .isType(EntityTypeProvider.nameETAllPrim, true) .n() .isCount(); } @@ -988,32 +991,32 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim, true) - .isTypeFilterOnCollection(EdmTechProvider.nameETBase); + .isType(EntityTypeProvider.nameETTwoPrim, true) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBase); testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(-32768)/com.sap.odata.test1.ETTwoBase") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim, false) - .isTypeFilterOnCollection(EdmTechProvider.nameETBase) + .isType(EntityTypeProvider.nameETTwoPrim, false) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBase) .isKeyPredicate(0, "PropertyInt16", "-32768") - .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBase); + .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase); testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(-32768)") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim, false) - .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase) + .isType(EntityTypeProvider.nameETTwoPrim, false) + .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase) .isKeyPredicate(0, "PropertyInt16", "-32768"); testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim, false) - .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase) + .isType(EntityTypeProvider.nameETTwoPrim, false) + .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase) .isKeyPredicate(0, "PropertyInt16", "-32768"); } @@ -1025,26 +1028,26 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() - .isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false); + .isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav" + "/PropertyComplex/PropertyInt16") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplex") .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); } @Test @@ -1118,48 +1121,48 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim) + .isType(EntityTypeProvider.nameETTwoPrim) .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnEntry(EdmTechProvider.nameETBase); + .isTypeFilterOnEntry(EntityTypeProvider.nameETBase); testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETTwoBase") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim) + .isType(EntityTypeProvider.nameETTwoPrim) .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBase); + .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase); testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim) + .isType(EntityTypeProvider.nameETTwoPrim) .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnCollection(EdmTechProvider.nameETBase); + .isTypeFilterOnCollection(EntityTypeProvider.nameETBase); testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(1)") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim) + .isType(EntityTypeProvider.nameETTwoPrim) .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase); + .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase); testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim) + .isType(EntityTypeProvider.nameETTwoPrim) .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnCollection(EdmTechProvider.nameETBase); + .isTypeFilterOnCollection(EntityTypeProvider.nameETBase); testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim) - .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase); + .isType(EntityTypeProvider.nameETTwoPrim) + .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase); } @Test @@ -1168,17 +1171,17 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav); + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav); testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'"); } @@ -1215,27 +1218,27 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "5") .n() .isComplex("CollPropertyComplex") - .isType(EdmTechProvider.nameCTTwoPrim, true); + .isType(ComplexTypeProvider.nameCTTwoPrim, true); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESKeyNav") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) .n() .isComplex("CollPropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, true); + .isType(ComplexTypeProvider.nameCTPrimComp, true); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex/$count") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESKeyNav") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) .n() .isComplex("CollPropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, true) + .isType(ComplexTypeProvider.nameCTPrimComp, true) .n() .isCount(); } @@ -1248,8 +1251,8 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplex"); @@ -1259,8 +1262,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .n() @@ -1274,15 +1277,15 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplexTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim) - .isTypeFilter(EdmTechProvider.nameCTBase); + .isType(ComplexTypeProvider.nameCTTwoPrim) + .isTypeFilter(ComplexTypeProvider.nameCTBase); testUri .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav" @@ -1290,14 +1293,14 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplexTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim) - .isTypeFilter(EdmTechProvider.nameCTTwoBase); + .isType(ComplexTypeProvider.nameCTTwoPrim) + .isTypeFilter(ComplexTypeProvider.nameCTTwoBase); } @Test @@ -1308,7 +1311,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true); + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true); testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)") .isKind(UriInfoKind.resource).goPath() @@ -1316,7 +1319,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2"); testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)") @@ -1325,7 +1328,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2"); testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16") @@ -1334,10 +1337,10 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyComplex") .isKind(UriInfoKind.resource).goPath() @@ -1345,7 +1348,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .n() .isComplex("PropertyComplex"); @@ -1356,10 +1359,10 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .n() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false); + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')" + "/NavPropertyETKeyNavMany(4)") @@ -1368,11 +1371,11 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "4"); testUri.run("ESKeyNav(1)/PropertyComplex/NavPropertyETTwoKeyNavOne") @@ -1383,7 +1386,7 @@ public class TestFullResourcePath { .n() .isComplex("PropertyComplex") .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false); + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')" + "/PropertyComplex/PropertyComplex/PropertyInt16") @@ -1392,7 +1395,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'(3)'") .n() @@ -1400,7 +1403,7 @@ public class TestFullResourcePath { .n() .isComplex("PropertyComplex") .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value") .isKind(UriInfoKind.resource).goPath() @@ -1408,7 +1411,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETMediaMany", EdmTechProvider.nameETMedia, false) + .isNavProperty("NavPropertyETMediaMany", EntityTypeProvider.nameETMedia, false) .isKeyPredicate(0, "PropertyInt16", "2") .n() .isValue(); @@ -1420,13 +1423,13 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) .n() - .isNavProperty("NavPropertyETMediaOne", EdmTechProvider.nameETMedia, false) + .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false) .n() .isValue(); @@ -1437,11 +1440,11 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) .n() .isRef(); } @@ -1453,24 +1456,24 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav" + "/NavPropertyETKeyNavMany(3)") .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "3"); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav" @@ -1478,15 +1481,15 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isEntitySet("ESTwoKeyNav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "3") .isKeyPredicate(1, "PropertyString", "'4'") - .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav); + .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')" + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')" @@ -1496,18 +1499,18 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "4") .isKeyPredicate(1, "PropertyString", "'5'") - .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav) .n() - .isNavProperty("NavPropertyETBaseTwoKeyNavMany", EdmTechProvider.nameETBaseTwoKeyNav, true); + .isNavProperty("NavPropertyETBaseTwoKeyNavMany", EntityTypeProvider.nameETBaseTwoKeyNav, true); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/" + "NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')/" @@ -1517,16 +1520,16 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "4") .isKeyPredicate(1, "PropertyString", "'5'") .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); } @Test @@ -1537,7 +1540,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16") .isKeyPredicate(1, "PropertyString", "'2'"); @@ -1546,7 +1549,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16") .isKeyPredicate(1, "PropertyString", "'2'"); @@ -1560,7 +1563,7 @@ public class TestFullResourcePath { .isEntitySet("ESAllPrim") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isPrimitiveProperty("PropertyByte", EdmTechProvider.nameByte, false); + .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false); testUri.run("ESAllPrim(1)/PropertyByte/$value") .isKind(UriInfoKind.resource).goPath() @@ -1568,7 +1571,7 @@ public class TestFullResourcePath { .isEntitySet("ESAllPrim") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isPrimitiveProperty("PropertyByte", EdmTechProvider.nameByte, false) + .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false) .n() .isValue(); @@ -1580,7 +1583,7 @@ public class TestFullResourcePath { .n() .isComplex("PropertyComplex") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); } @Test @@ -1591,7 +1594,7 @@ public class TestFullResourcePath { .isEntitySet("ESCollAllPrim") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true); + .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString") .isKind(UriInfoKind.resource).goPath() @@ -1599,9 +1602,9 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .n() - .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true); + .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count") .isKind(UriInfoKind.resource).goPath() @@ -1609,11 +1612,11 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() - .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true) + .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true) .n() .isCount(); @@ -1641,7 +1644,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) .n() .isRef(); testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref") @@ -1650,7 +1653,7 @@ public class TestFullResourcePath { .isEntitySet("ESKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .n() @@ -1673,8 +1676,8 @@ public class TestFullResourcePath { .isFunctionImport("FICRTETTwoKeyNavParam") .isFunction("UFCRTETTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav"); @@ -1686,8 +1689,8 @@ public class TestFullResourcePath { .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() @@ -1702,7 +1705,7 @@ public class TestFullResourcePath { .first() .isFunctionImport("FICRTETKeyNav") .isFunction("UFCRTETKeyNav") - .isType(EdmTechProvider.nameETKeyNav); + .isType(EntityTypeProvider.nameETKeyNav); testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')") .isKind(UriInfoKind.resource).goPath() @@ -1741,8 +1744,8 @@ public class TestFullResourcePath { .isFunctionImport("FICRTETTwoKeyNavParam") .isFunction("UFCRTETTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav); testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')" + "/com.sap.odata.test1.ETBaseTwoKeyNav") @@ -1753,8 +1756,8 @@ public class TestFullResourcePath { .isParameter(0, "ParameterInt16", "1") .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav); testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)" + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')") @@ -1763,8 +1766,8 @@ public class TestFullResourcePath { .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'"); } @@ -1779,7 +1782,7 @@ public class TestFullResourcePath { .isFunction("UFCRTESMixPrimCollCompTwoParam") .isParameter(0, "ParameterInt16", "1") .isParameter(1, "ParameterString", "'2'") - .isType(EdmTechProvider.nameETMixPrimCollComp); + .isType(EntityTypeProvider.nameETMixPrimCollComp); testUri.run("FINRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')") .isKind(UriInfoKind.resource).goPath() @@ -1788,7 +1791,7 @@ public class TestFullResourcePath { .isFunction("UFNRTESMixPrimCollCompTwoParam") .isParameter(0, "ParameterInt16", "1") .isParameter(1, "ParameterString", "'2'") - .isType(EdmTechProvider.nameETMixPrimCollComp); + .isType(EntityTypeProvider.nameETMixPrimCollComp); testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count") .isKind(UriInfoKind.resource).goPath() @@ -1797,7 +1800,7 @@ public class TestFullResourcePath { .isFunction("UFCRTESMixPrimCollCompTwoParam") .isParameter(0, "ParameterInt16", "1") .isParameter(1, "ParameterString", "'2'") - .isType(EdmTechProvider.nameETMixPrimCollComp) + .isType(EntityTypeProvider.nameETMixPrimCollComp) .n() .isCount(); } @@ -1825,8 +1828,8 @@ public class TestFullResourcePath { .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav); testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav/$count") .isKind(UriInfoKind.resource).goPath() @@ -1834,8 +1837,8 @@ public class TestFullResourcePath { .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isCount(); @@ -1846,8 +1849,8 @@ public class TestFullResourcePath { .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'"); @@ -1859,11 +1862,11 @@ public class TestFullResourcePath { .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") - .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav); + .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav); } @@ -1882,19 +1885,19 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany(1)") .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1"); } @@ -1905,8 +1908,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplex"); @@ -1914,8 +1917,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplex") .n() @@ -1925,12 +1928,12 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) .n() .isComplex("PropertyComplexTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim) - .isTypeFilter(EdmTechProvider.nameCTBase); + .isType(ComplexTypeProvider.nameCTTwoPrim) + .isTypeFilter(ComplexTypeProvider.nameCTBase); } @@ -1940,20 +1943,20 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/CollPropertyString") .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) .n() - .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true) - .isType(EdmTechProvider.nameString, true); + .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true) + .isType(PropertyProvider.nameString, true); } @@ -1964,14 +1967,14 @@ public class TestFullResourcePath { .first() .isSingleton("SINav") .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); testUri.run("SINav/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')") .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'"); @@ -2005,7 +2008,7 @@ public class TestFullResourcePath { .isSingleton("SINav") .n() .isComplex("CollPropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, true); + .isType(ComplexTypeProvider.nameCTPrimComp, true); testUri.run("SINav/CollPropertyComplex/$count") .isKind(UriInfoKind.resource).goPath() @@ -2013,7 +2016,7 @@ public class TestFullResourcePath { .isSingleton("SINav") .n() .isComplex("CollPropertyComplex") - .isType(EdmTechProvider.nameCTPrimComp, true) + .isType(ComplexTypeProvider.nameCTPrimComp, true) .n() .isCount(); } @@ -2025,7 +2028,7 @@ public class TestFullResourcePath { .first() .isSingleton("SINav") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); } @Test @@ -2036,13 +2039,13 @@ public class TestFullResourcePath { .first() .isSingleton("SINav") .n() - .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true); + .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true); testUri.run("SINav/CollPropertyString/$count") .isKind(UriInfoKind.resource).goPath() .first() .isSingleton("SINav") .n() - .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true) + .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true) .n() .isCount(); } @@ -2067,7 +2070,7 @@ public class TestFullResourcePath { .isSegmentStar(0).isSegmentRef(1) .next() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); testUri.run("ESKeyNav(1)?$expand=*($levels=3)") .isKind(UriInfoKind.resource).goPath().goExpand() @@ -2085,24 +2088,24 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isRef(); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$ref") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav, false) .n().isRef(); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($filter=PropertyInt16 eq 1)") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isRef() .goUpExpandValidator().isFilterSerialized("< eq <1>>"); @@ -2110,19 +2113,19 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isRef() .goUpExpandValidator() .isSortOrder(0, false) - .goOrder(0).goPath().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .goOrder(0).goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1)") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isRef() .goUpExpandValidator() .isSkipText("1"); @@ -2131,8 +2134,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isRef() .goUpExpandValidator() .isTopText("2"); @@ -2141,8 +2144,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isRef() .goUpExpandValidator() .isInlineCountText("true"); @@ -2151,8 +2154,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isRef() .goUpExpandValidator() .isSkipText("1") @@ -2162,8 +2165,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isRef() .goUpExpandValidator() .isSkipText("1") @@ -2173,24 +2176,24 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isCount(); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$count") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav, false) .n().isCount(); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count($filter=PropertyInt16 gt 1)") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .n().isCount() .goUpExpandValidator() .isFilterSerialized("< gt <1>>"); @@ -2199,8 +2202,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isFilterSerialized("< eq <1>>"); @@ -2208,18 +2211,18 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isSortOrder(0, false) - .goOrder(0).goPath().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .goOrder(0).goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1)") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isSkipText("1"); @@ -2227,8 +2230,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isTopText("2"); @@ -2236,8 +2239,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isInlineCountText("true"); @@ -2245,40 +2248,40 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isSelectText("PropertyString") - .goSelectItem(0).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .goSelectItem(0).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($expand=NavPropertyETTwoKeyNavOne)") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .goExpand() .goPath().first() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false); + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($expand=NavPropertyETKeyNavMany)") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .goExpand() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=5)") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav, false) .goUpExpandValidator() .isLevelText("5"); @@ -2286,18 +2289,18 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isSelectText("PropertyString") - .goSelectItem(0).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .goSelectItem(0).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=max)") .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav, false) .goUpExpandValidator() .isLevelText("max"); @@ -2305,8 +2308,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isSkipText("1") .isTopText("2"); @@ -2315,8 +2318,8 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource).goPath().goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true) .goUpExpandValidator() .isSkipText("1") .isTopText("2"); @@ -2329,19 +2332,19 @@ public class TestFullResourcePath { .goExpand() .first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav, true); testUri.run("ESTwoKeyNav?" + "$expand=com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany") .isKind(UriInfoKind.resource).goPath().first() .goExpand().first() - .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) + .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav) .goPath().first() - // .isType(EdmTechProvider.nameETTwoKeyNav) - // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + // .isType(EntityTypeProvider.nameETTwoKeyNav) + // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) // .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?" + "$expand=com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany") @@ -2349,12 +2352,12 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'Hugo'") .goExpand().first() - .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) + .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav) .goPath().first() - // .isType(EdmTechProvider.nameETTwoKeyNav) - // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + // .isType(EntityTypeProvider.nameETTwoKeyNav) + // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) // .n() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?" + "$expand=com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETTwoKeyNavMany") @@ -2362,12 +2365,12 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .goExpand().first() - .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) + .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav) .goPath().first() - // .isType(EdmTechProvider.nameETTwoKeyNav) - // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + // .isType(EntityTypeProvider.nameETTwoKeyNav) + // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) // .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true); + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav" + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav") @@ -2375,52 +2378,52 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .goExpand().first() - .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) + .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav) .goPath().first() - // .isType(EdmTechProvider.nameETTwoKeyNav) - // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + // .isType(EntityTypeProvider.nameETTwoKeyNav) + // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) // .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) - .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav); + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) + .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav); testUri.run("ESTwoKeyNav?$expand=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexNav/NavPropertyETTwoKeyNavOne") .isKind(UriInfoKind.resource).goPath().first() .goExpand().first() - .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) + .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav) .goPath().first() - // .isType(EdmTechProvider.nameETTwoKeyNav) - // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + // .isType(EntityTypeProvider.nameETTwoKeyNav) + // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) // .n() .isComplex("PropertyComplexNav") - .isType(EdmTechProvider.nameCTBasePrimCompNav) + .isType(ComplexTypeProvider.nameCTBasePrimCompNav) .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false); + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false); testUri.run("ESTwoKeyNav?$expand=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexNav" + "/com.sap.odata.test1.CTTwoBasePrimCompNav/NavPropertyETTwoKeyNavOne") .isKind(UriInfoKind.resource).goPath().first() .goExpand().first() - .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) + .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav) .goPath().first() - // .isType(EdmTechProvider.nameETTwoKeyNav) - // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + // .isType(EntityTypeProvider.nameETTwoKeyNav) + // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) // .n() .isComplex("PropertyComplexNav") - .isType(EdmTechProvider.nameCTBasePrimCompNav) + .isType(ComplexTypeProvider.nameCTBasePrimCompNav) .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false); + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false); testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref,NavPropertyETTwoKeyNavMany($skip=2;$top=1)") .isKind(UriInfoKind.resource).goPath().first() .goExpand().first() .goPath() .first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) .n().isRef() .goUpExpandValidator() .next() .goPath() - .first().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) + .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) .goUpExpandValidator() .isSkipText("2") .isTopText("1"); @@ -2432,16 +2435,16 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .goExpand().first() - .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) + .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav) .goPath().first() // .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - // .isType(EdmTechProvider.nameETTwoKeyNav) - // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) - // .n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav) + // .isType(EntityTypeProvider.nameETTwoKeyNav) + // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) + // .n().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav) .goUpExpandValidator() - .goSelectItem(0).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .goSelectItem(0).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($expand=NavPropertyETKeyNavMany(" + "$expand=NavPropertyETKeyNavOne))") @@ -2449,18 +2452,18 @@ public class TestFullResourcePath { .goPath().first() .goExpand().first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav) .goUpExpandValidator() .goExpand().first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true) - .isType(EdmTechProvider.nameETKeyNav) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true) + .isType(EntityTypeProvider.nameETKeyNav) .goUpExpandValidator() .goExpand().first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav); + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$select=com.sap.odata.test1.ETBaseTwoKeyNav" + "/PropertyInt16") @@ -2468,29 +2471,29 @@ public class TestFullResourcePath { .first() .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isSelectStartType(0, EdmTechProvider.nameETBaseTwoKeyNav) + .isSelectStartType(0, EntityTypeProvider.nameETBaseTwoKeyNav) .goSelectItem(0) .first() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyInt16)") .isKind(UriInfoKind.resource) .goPath().first() .goExpand().first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav) .goUpExpandValidator() .isSelectText("PropertyInt16") - .goSelectItem(0).isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .goSelectItem(0).isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyComplex/PropertyInt16)") .isKind(UriInfoKind.resource) .goPath().first() .goExpand().first() .goPath().first() - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav) .goUpExpandValidator() .isSelectText("PropertyComplex/PropertyInt16"); } @@ -2610,7 +2613,7 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource) .goPath() .isFunctionImport("FICRTESMixPrimCollCompTwoParam") - .isType(EdmTechProvider.nameETMixPrimCollComp) + .isType(EntityTypeProvider.nameETMixPrimCollComp) .isParameter(0, "ParameterInt16", "1") .isParameter(1, "ParameterString", "'2'"); @@ -2618,19 +2621,19 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource) .goPath().first() .isFunctionImport("FICRTETKeyNav") - .isType(EdmTechProvider.nameETKeyNav); + .isType(EntityTypeProvider.nameETKeyNav); testUri.run("FICRTCollCTTwoPrim()") .isKind(UriInfoKind.resource) .goPath().first() .isFunctionImport("FICRTCollCTTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim); + .isType(ComplexTypeProvider.nameCTTwoPrim); testUri.run("FICRTCTAllPrimTwoParam(ParameterInt16=1,ParameterString='2')") .isKind(UriInfoKind.resource) .goPath().first() .isFunctionImport("FICRTCTAllPrimTwoParam") - .isType(EdmTechProvider.nameCTAllPrim) + .isType(ComplexTypeProvider.nameCTAllPrim) .isParameter(0, "ParameterInt16", "1") .isParameter(1, "ParameterString", "'2'"); @@ -2638,7 +2641,7 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource) .goPath().first() .isFunctionImport("FICRTCollStringTwoParam") - .isType(EdmTechProvider.nameString) + .isType(PropertyProvider.nameString) .isParameter(0, "ParameterInt16", "1") .isParameter(1, "ParameterString", "'2'"); @@ -2647,7 +2650,7 @@ public class TestFullResourcePath { .goPath().first() .isFunctionImport("FICRTStringTwoParam") .isFunction("UFCRTStringTwoParam") - .isType(EdmTechProvider.nameString) + .isType(PropertyProvider.nameString) .isParameter(0, "ParameterInt16", "1"); testUri.run("FICRTStringTwoParam(ParameterInt16=1,ParameterString='2')") @@ -2655,7 +2658,7 @@ public class TestFullResourcePath { .goPath().first() .isFunctionImport("FICRTStringTwoParam") .isFunction("UFCRTStringTwoParam") - .isType(EdmTechProvider.nameString) + .isType(PropertyProvider.nameString) .isParameter(0, "ParameterInt16", "1"); testUri.run("AIRTETParam") @@ -2708,7 +2711,7 @@ public class TestFullResourcePath { .isKind(UriInfoKind.resource) .goPath().first() .isEntitySet("ESTwoKeyNav") - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav); + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav); testUri.run("ESTwoKeyNav/$count") .isKind(UriInfoKind.resource) @@ -2763,8 +2766,8 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/$ref") .isKind(UriInfoKind.resource) @@ -2772,8 +2775,8 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n().isRef(); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/$value") @@ -2781,8 +2784,8 @@ public class TestFullResourcePath { .isEntitySet("ESTwoKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .n().isValue(); } @@ -2792,40 +2795,40 @@ public class TestFullResourcePath { testFilter.runOnETTwoKeyNav("PropertyString") .is("") - .isType(EdmTechProvider.nameString); + .isType(PropertyProvider.nameString); testFilter.runOnETTwoKeyNav("PropertyComplex/PropertyInt16") .is("") - .isType(EdmTechProvider.nameInt16); + .isType(PropertyProvider.nameInt16); testFilter.runOnETTwoKeyNav("PropertyComplex/PropertyComplex/PropertyDate") .is("") - .isType(EdmTechProvider.nameDate); + .isType(PropertyProvider.nameDate); testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne") .is("") - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyString") .is("") - .isType(EdmTechProvider.nameString); + .isType(PropertyProvider.nameString); testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex") .is("") - .isType(EdmTechProvider.nameCTPrimComp); + .isType(ComplexTypeProvider.nameCTPrimComp); testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex") .is("") - .isType(EdmTechProvider.nameCTAllPrim); + .isType(ComplexTypeProvider.nameCTAllPrim); testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyInt16") .is("") - .isType(EdmTechProvider.nameInt16); + .isType(PropertyProvider.nameInt16); testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyInt16 eq 1") .is("< eq <1>>") .root().left() - .isType(EdmTechProvider.nameInt16) + .isType(PropertyProvider.nameInt16) .root().right() .isLiteral("1"); @@ -2833,29 +2836,29 @@ public class TestFullResourcePath { + "PropertyString eq 'SomeString'") .is("< eq <'SomeString'>>") .root().left() - .isType(EdmTechProvider.nameString) + .isType(PropertyProvider.nameString) .isMember().goPath() .first() - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .n() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16") .isKeyPredicate(1, "PropertyString", "'2'") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .goUpFilterValidator() .root().right(); testFilter.runOnETTwoKeyNav("com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12") .is("< eq <2013-11-12>>") .root().left() - .isType(EdmTechProvider.nameDate) - .isMember().isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath() + .isType(PropertyProvider.nameDate) + .isMember().isMemberStartType(EntityTypeProvider.nameETBaseTwoKeyNav).goPath() // .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter) - // .isType(EdmTechProvider.nameETTwoKeyNav).isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) - // .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) - .first().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) + // .isType(EntityTypeProvider.nameETTwoKeyNav).isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) + // .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false) + .first().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false) .goUpFilterValidator() .root().right() .isLiteral("2013-11-12"); @@ -2863,12 +2866,12 @@ public class TestFullResourcePath { testFilter.runOnCTTwoPrim("com.sap.odata.test1.CTBase/AdditionalPropString eq 'SomeString'") .is("< eq <'SomeString'>>") .root().left() - .isType(EdmTechProvider.nameString) - .isMember().isMemberStartType(EdmTechProvider.nameCTBase).goPath() + .isType(PropertyProvider.nameString) + .isMember().isMemberStartType(ComplexTypeProvider.nameCTBase).goPath() // .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter) - // .isType(EdmTechProvider.nameCTTwoPrim).isTypeFilterOnEntry(EdmTechProvider.nameCTBase) - // .n().isPrimitiveProperty("AdditionalPropString", EdmTechProvider.nameString, false) - .first().isPrimitiveProperty("AdditionalPropString", EdmTechProvider.nameString, false) + // .isType(EntityTypeProvider.nameCTTwoPrim).isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase) + // .n().isPrimitiveProperty("AdditionalPropString", PropertyProvider.nameString, false) + .first().isPrimitiveProperty("AdditionalPropString", PropertyProvider.nameString, false) .goUpFilterValidator() .root().right() .isLiteral("'SomeString'"); @@ -2877,7 +2880,7 @@ public class TestFullResourcePath { .runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12") .is("< eq <2013-11-12>>") .root().left() - .isType(EdmTechProvider.nameDate) + .isType(PropertyProvider.nameDate) .root().right() .isLiteral("2013-11-12"); @@ -2885,7 +2888,7 @@ public class TestFullResourcePath { .runOnETTwoKeyNav("PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase/AdditionalPropString eq 'SomeString'") .is("< eq <'SomeString'>>") .root().left() - .isType(EdmTechProvider.nameString) + .isType(PropertyProvider.nameString) .root().right() .isLiteral("'SomeString'"); @@ -2902,332 +2905,332 @@ public class TestFullResourcePath { .is("< eq >") .isBinary(BinaryOperatorKind.EQ) .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertySByte ne PropertySByte") .is("< ne >") .isBinary(BinaryOperatorKind.NE) .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertySByte add PropertySByte") .is("< add >") .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertyByte add PropertyByte") .is("< add >") .root().left() - .isType(EdmTechProvider.nameByte) + .isType(PropertyProvider.nameByte) .root().right() - .isType(EdmTechProvider.nameByte); + .isType(PropertyProvider.nameByte); testFilter.runOnETAllPrim("PropertyInt16 add PropertyInt16") .is("< add >") .root().left() - .isType(EdmTechProvider.nameInt16) + .isType(PropertyProvider.nameInt16) .root().right() - .isType(EdmTechProvider.nameInt16); + .isType(PropertyProvider.nameInt16); testFilter.runOnETAllPrim("PropertyInt32 add PropertyInt32") .is("< add >") .root().left() - .isType(EdmTechProvider.nameInt32) + .isType(PropertyProvider.nameInt32) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertyInt64 add PropertyInt64") .is("< add >") .root().left() - .isType(EdmTechProvider.nameInt64) + .isType(PropertyProvider.nameInt64) .root().right() - .isType(EdmTechProvider.nameInt64); + .isType(PropertyProvider.nameInt64); testFilter.runOnETAllPrim("PropertySingle add PropertySingle") .is("< add >") .root().left() - .isType(EdmTechProvider.nameSingle) + .isType(PropertyProvider.nameSingle) .root().right() - .isType(EdmTechProvider.nameSingle); + .isType(PropertyProvider.nameSingle); testFilter.runOnETAllPrim("PropertyDouble add PropertyDouble") .is("< add >") .root().left() - .isType(EdmTechProvider.nameDouble) + .isType(PropertyProvider.nameDouble) .root().right() - .isType(EdmTechProvider.nameDouble); + .isType(PropertyProvider.nameDouble); testFilter.runOnETAllPrim("PropertyDecimal add PropertyDecimal") .is("< add >") .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertySByte add PropertyDecimal") .is("< add >") .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertySByte add PropertyInt32") .is("< add >") .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertySByte add PropertyInt64") .is("< add >") .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameInt64); + .isType(PropertyProvider.nameInt64); testFilter.runOnETAllPrim("PropertyDateTimeOffset add PropertyDuration") .is("< add >") .root().left() - .isType(EdmTechProvider.nameDateTimeOffset) + .isType(PropertyProvider.nameDateTimeOffset) .root().right() - .isType(EdmTechProvider.nameDuration); + .isType(PropertyProvider.nameDuration); testFilter.runOnETAllPrim("PropertyDuration add PropertyDuration") .is("< add >") .root().left() - .isType(EdmTechProvider.nameDuration) + .isType(PropertyProvider.nameDuration) .root().right() - .isType(EdmTechProvider.nameDuration); + .isType(PropertyProvider.nameDuration); testFilter.runOnETAllPrim("PropertyDate add PropertyDuration") .is("< add >") .root().left() - .isType(EdmTechProvider.nameDate) + .isType(PropertyProvider.nameDate) .root().right() - .isType(EdmTechProvider.nameDuration); + .isType(PropertyProvider.nameDuration); testFilter.runOnETAllPrim("PropertySByte sub PropertySByte") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertyByte sub PropertyByte") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameByte) + .isType(PropertyProvider.nameByte) .root().right() - .isType(EdmTechProvider.nameByte); + .isType(PropertyProvider.nameByte); testFilter.runOnETAllPrim("PropertyInt16 sub PropertyInt16") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameInt16) + .isType(PropertyProvider.nameInt16) .root().right() - .isType(EdmTechProvider.nameInt16); + .isType(PropertyProvider.nameInt16); testFilter.runOnETAllPrim("PropertyInt32 sub PropertyInt32") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameInt32) + .isType(PropertyProvider.nameInt32) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertyInt64 sub PropertyInt64") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameInt64) + .isType(PropertyProvider.nameInt64) .root().right() - .isType(EdmTechProvider.nameInt64); + .isType(PropertyProvider.nameInt64); testFilter.runOnETAllPrim("PropertySingle sub PropertySingle") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameSingle) + .isType(PropertyProvider.nameSingle) .root().right() - .isType(EdmTechProvider.nameSingle); + .isType(PropertyProvider.nameSingle); testFilter.runOnETAllPrim("PropertyDouble sub PropertyDouble") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDouble) + .isType(PropertyProvider.nameDouble) .root().right() - .isType(EdmTechProvider.nameDouble); + .isType(PropertyProvider.nameDouble); testFilter.runOnETAllPrim("PropertyDecimal sub PropertyDecimal") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyDecimal sub PropertyInt32") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertyDecimal sub PropertyInt64") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameInt64); + .isType(PropertyProvider.nameInt64); testFilter.runOnETAllPrim("PropertyDecimal sub PropertyByte") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameByte); + .isType(PropertyProvider.nameByte); testFilter.runOnETAllPrim("PropertyDateTimeOffset sub PropertyDuration") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDateTimeOffset) + .isType(PropertyProvider.nameDateTimeOffset) .root().right() - .isType(EdmTechProvider.nameDuration); + .isType(PropertyProvider.nameDuration); testFilter.runOnETAllPrim("PropertyDuration sub PropertyDuration") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDuration) + .isType(PropertyProvider.nameDuration) .root().right() - .isType(EdmTechProvider.nameDuration); + .isType(PropertyProvider.nameDuration); testFilter.runOnETAllPrim("PropertyDateTimeOffset sub PropertyDateTimeOffset") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDateTimeOffset) + .isType(PropertyProvider.nameDateTimeOffset) .root().right() - .isType(EdmTechProvider.nameDateTimeOffset); + .isType(PropertyProvider.nameDateTimeOffset); testFilter.runOnETAllPrim("PropertyDate sub PropertyDuration") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDate) + .isType(PropertyProvider.nameDate) .root().right() - .isType(EdmTechProvider.nameDuration); + .isType(PropertyProvider.nameDuration); testFilter.runOnETAllPrim("PropertyDate sub PropertyDate") .is("< sub >") .root().left() - .isType(EdmTechProvider.nameDate) + .isType(PropertyProvider.nameDate) .root().right() - .isType(EdmTechProvider.nameDate); + .isType(PropertyProvider.nameDate); testFilter.runOnETAllPrim("PropertySByte mul PropertySByte") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertyByte mul PropertyByte") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameByte) + .isType(PropertyProvider.nameByte) .root().right() - .isType(EdmTechProvider.nameByte); + .isType(PropertyProvider.nameByte); testFilter.runOnETAllPrim("PropertyInt16 mul PropertyInt16") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameInt16) + .isType(PropertyProvider.nameInt16) .root().right() - .isType(EdmTechProvider.nameInt16); + .isType(PropertyProvider.nameInt16); testFilter.runOnETAllPrim("PropertyInt32 mul PropertyInt32") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameInt32) + .isType(PropertyProvider.nameInt32) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertyInt64 mul PropertyInt64") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameInt64) + .isType(PropertyProvider.nameInt64) .root().right() - .isType(EdmTechProvider.nameInt64); + .isType(PropertyProvider.nameInt64); testFilter.runOnETAllPrim("PropertySingle mul PropertySingle") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameSingle) + .isType(PropertyProvider.nameSingle) .root().right() - .isType(EdmTechProvider.nameSingle); + .isType(PropertyProvider.nameSingle); testFilter.runOnETAllPrim("PropertyDouble mul PropertyDouble") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameDouble) + .isType(PropertyProvider.nameDouble) .root().right() - .isType(EdmTechProvider.nameDouble); + .isType(PropertyProvider.nameDouble); testFilter.runOnETAllPrim("PropertyDecimal mul PropertyDecimal") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyInt64 mul PropertyInt32") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameInt64) + .isType(PropertyProvider.nameInt64) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertyInt64 mul PropertySByte") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameInt64) + .isType(PropertyProvider.nameInt64) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertyInt64 mul PropertyDecimal") .is("< mul >") .root().left() - .isType(EdmTechProvider.nameInt64) + .isType(PropertyProvider.nameInt64) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertySByte div PropertySByte") .is("< div >") .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertyByte div PropertyByte") .is("< div >") .root().left() - .isType(EdmTechProvider.nameByte) + .isType(PropertyProvider.nameByte) .root().right() - .isType(EdmTechProvider.nameByte); + .isType(PropertyProvider.nameByte); testFilter.runOnETAllPrim("PropertyInt16 div PropertyInt16") .is("< div >") .root().left() - .isType(EdmTechProvider.nameInt16) + .isType(PropertyProvider.nameInt16) .root().right() - .isType(EdmTechProvider.nameInt16); + .isType(PropertyProvider.nameInt16); testFilter.runOnETAllPrim("PropertyInt32 div PropertyInt32") .is("< div >") .root().left() - .isType(EdmTechProvider.nameInt32) + .isType(PropertyProvider.nameInt32) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertyInt64 div PropertyInt64") .is("< div >") .root().left() - .isType(EdmTechProvider.nameInt64) + .isType(PropertyProvider.nameInt64) .root().right() - .isType(EdmTechProvider.nameInt64); + .isType(PropertyProvider.nameInt64); testFilter.runOnETAllPrim("PropertySingle div PropertySingle") .is("< div >") .root().left() - .isType(EdmTechProvider.nameSingle) + .isType(PropertyProvider.nameSingle) .root().right() - .isType(EdmTechProvider.nameSingle); + .isType(PropertyProvider.nameSingle); testFilter.runOnETAllPrim("PropertyDouble div PropertyDouble") .is("< div >") .root().left() - .isType(EdmTechProvider.nameDouble) + .isType(PropertyProvider.nameDouble) .root().right() - .isType(EdmTechProvider.nameDouble); + .isType(PropertyProvider.nameDouble); testFilter.runOnETAllPrim("PropertyDecimal div PropertyDecimal") .is("< div >") .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyByte div PropertyInt32") .is("< div >") .root().left() - .isType(EdmTechProvider.nameByte) + .isType(PropertyProvider.nameByte) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertyByte div PropertyDecimal") .is("< div >") .root().left() - .isType(EdmTechProvider.nameByte) + .isType(PropertyProvider.nameByte) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyByte div PropertySByte") .is("< div >") .root().left() - .isType(EdmTechProvider.nameByte) + .isType(PropertyProvider.nameByte) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertyByte div 0") .is("< div <0>>"); @@ -3238,81 +3241,81 @@ public class TestFullResourcePath { testFilter.runOnETAllPrim("PropertySByte mod PropertySByte") .is("< mod >") .root().left() - .isType(EdmTechProvider.nameSByte) + .isType(PropertyProvider.nameSByte) .root().right() - .isType(EdmTechProvider.nameSByte); + .isType(PropertyProvider.nameSByte); testFilter.runOnETAllPrim("PropertyByte mod PropertyByte") .is("< mod >") .root().left() - .isType(EdmTechProvider.nameByte) + .isType(PropertyProvider.nameByte) .root().right() - .isType(EdmTechProvider.nameByte); + .isType(PropertyProvider.nameByte); testFilter.runOnETAllPrim("PropertyInt16 mod PropertyInt16") .is("< mod >") .root().left() - .isType(EdmTechProvider.nameInt16) + .isType(PropertyProvider.nameInt16) .root().right() - .isType(EdmTechProvider.nameInt16); + .isType(PropertyProvider.nameInt16); testFilter.runOnETAllPrim("PropertyInt32 mod PropertyInt32") .is("< mod >") .root().left() - .isType(EdmTechProvider.nameInt32) + .isType(PropertyProvider.nameInt32) .root().right() - .isType(EdmTechProvider.nameInt32); + .isType(PropertyProvider.nameInt32); testFilter.runOnETAllPrim("PropertyInt64 mod PropertyInt64") .is("< mod >") .root().left() - .isType(EdmTechProvider.nameInt64) + .isType(PropertyProvider.nameInt64) .root().right() - .isType(EdmTechProvider.nameInt64); + .isType(PropertyProvider.nameInt64); testFilter.runOnETAllPrim("PropertySingle mod PropertySingle") .is("< mod >") .root().left() - .isType(EdmTechProvider.nameSingle) + .isType(PropertyProvider.nameSingle) .root().right() - .isType(EdmTechProvider.nameSingle); + .isType(PropertyProvider.nameSingle); testFilter.runOnETAllPrim("PropertyDouble mod PropertyDouble") .is("< mod >") .root().left() - .isType(EdmTechProvider.nameDouble) + .isType(PropertyProvider.nameDouble) .root().right() - .isType(EdmTechProvider.nameDouble); + .isType(PropertyProvider.nameDouble); testFilter.runOnETAllPrim("PropertyDecimal mod PropertyDecimal") .is("< mod >") .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); // testFilter.runOnETAllPrim("PropertyDecimal ge PropertyDecimal") .is("< ge >") .isBinary(BinaryOperatorKind.GE) .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyDecimal lt PropertyDecimal") .is("< lt >") .isBinary(BinaryOperatorKind.LT) .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyDecimal le PropertyDecimal") .is("< le >") .isBinary(BinaryOperatorKind.LE) .root().left() - .isType(EdmTechProvider.nameDecimal) + .isType(PropertyProvider.nameDecimal) .root().right() - .isType(EdmTechProvider.nameDecimal); + .isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyDecimal sub NaN") - .right().isLiteral("NaN").isType(EdmTechProvider.nameDecimal); + .right().isLiteral("NaN").isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyDecimal sub -INF") - .right().isLiteral("-INF").isType(EdmTechProvider.nameDecimal); + .right().isLiteral("-INF").isType(PropertyProvider.nameDecimal); testFilter.runOnETAllPrim("PropertyDecimal sub INF") - .right().isLiteral("INF").isType(EdmTechProvider.nameDecimal); + .right().isLiteral("INF").isType(PropertyProvider.nameDecimal); } @Test @@ -3334,7 +3337,7 @@ public class TestFullResourcePath { .is("< eq <'SomeString'>>") .root().left().goPath() .first() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .n() .isFunction("BFCCTPrimCompRTESTwoKeyNavParam") .isParameter(0, "ParameterString", "PropertyComplex/PropertyComplex/PropertyString") @@ -3343,33 +3346,33 @@ public class TestFullResourcePath { .goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .goUpToResourceValidator() .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNav("PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTETTwoKeyNavParam" + "(ParameterString=null)/PropertyString eq 'SomeString'") .is("< eq <'SomeString'>>") .root().left().goPath() .first() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .n() .isFunction("BFCCTPrimCompRTETTwoKeyNavParam") .goParameter(0) .isNull() .goUpToResourceValidator() .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavMany/com.sap.odata.test1.BFCESTwoKeyNavRTString()" + " eq 'SomeString'") .is("< eq <'SomeString'>>") .root().left().goPath() .first() - .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) .n() .isFunction("BFCESTwoKeyNavRTString"); @@ -3381,7 +3384,7 @@ public class TestFullResourcePath { .n() .isFunction("BFESTwoKeyNavRTESTwoKeyNav") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNav("com.sap.odata.test1.BFESTwoKeyNavRTESTwoKeyNav()/PropertyString eq 'SomeString'") .is("< eq <'SomeString'>>") @@ -3389,7 +3392,7 @@ public class TestFullResourcePath { .first() .isFunction("BFESTwoKeyNavRTESTwoKeyNav") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/com.sap.odata.test1.BFCETTwoKeyNavRTETTwoKeyNav()" + "/PropertyComplex/PropertyComplex/PropertyString eq 'Walldorf'") @@ -3397,15 +3400,15 @@ public class TestFullResourcePath { + "eq <'Walldorf'>>") .root().left().goPath() .first() - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) .n() .isFunction("BFCETTwoKeyNavRTETTwoKeyNav") .n() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .n() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false) .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNav("PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNavParam" + "(ParameterString='1')" @@ -3415,14 +3418,14 @@ public class TestFullResourcePath { + "eq <'SomeString'>>") .root().left().goPath() .first() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .n() .isFunction("BFCCTPrimCompRTESTwoKeyNavParam") - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) .isKeyPredicate(0, "PropertyInt16", "2") .isKeyPredicate(1, "PropertyString", "'3'") .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNavSingle("$it/com.sap.odata.test1.BFCETTwoKeyNavRTCTTwoPrim()/com.sap.odata.test1.CTBase" + "/PropertyString eq 'SomeString'") @@ -3432,9 +3435,9 @@ public class TestFullResourcePath { .isIt() .n() .isFunction("BFCETTwoKeyNavRTCTTwoPrim") - .isTypeFilterOnEntry(EdmTechProvider.nameCTBase) + .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase) .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16 eq 2") .is("< eq <2>>") @@ -3443,7 +3446,7 @@ public class TestFullResourcePath { .isFunction("UFCRTETTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=@Param1Alias)" + "/PropertyInt16 eq 2") @@ -3452,7 +3455,7 @@ public class TestFullResourcePath { .isFunction("UFCRTETTwoKeyNavParam") .isParameterAlias(0, "ParameterInt16", "Param1Alias") .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=1)" + "/PropertyComplex/PropertyComplex/PropertyString eq 'SomeString'") @@ -3461,11 +3464,11 @@ public class TestFullResourcePath { .isFunction("UFCRTETTwoKeyNavParam") .isParameter(0, "ParameterInt16", "1") .n() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .n() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false) .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=PropertyInt16)" + "/PropertyComplex/PropertyComplex/PropertyString eq 'SomeString'") @@ -3474,11 +3477,11 @@ public class TestFullResourcePath { .isFunction("UFCRTETTwoKeyNavParam") .isParameter(0, "ParameterInt16", "PropertyInt16") .n() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .n() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false) .n() - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); } @@ -3895,23 +3898,23 @@ public class TestFullResourcePath { .root().left() .goPath() .first().isUriPathInfoKind(UriResourceKind.it) - .isType(EdmTechProvider.nameETTwoKeyNav, true) - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isType(EntityTypeProvider.nameETTwoKeyNav, true) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnCTTwoPrim("$it/PropertyString eq 'SomeString'") .is("<<$it/PropertyString> eq <'SomeString'>>") .root().left() .goPath() .first().isUriPathInfoKind(UriResourceKind.it) - .isType(EdmTechProvider.nameCTTwoPrim, false) - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isType(ComplexTypeProvider.nameCTTwoPrim, false) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOnString("$it eq 'Walldorf'") .is("<<$it> eq <'Walldorf'>>") .root().left() .goPath() .first().isUriPathInfoKind(UriResourceKind.it) - .isType(EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameString, false); testFilter.runOnString("endswith($it,'sap.com')") .is(",<'sap.com'>)>") @@ -3921,7 +3924,7 @@ public class TestFullResourcePath { .goParameter(0) .goPath() .first().isUriPathInfoKind(UriResourceKind.it) - .isType(EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameString, false); testFilter.runOnString("endswith($it,'sap.com') eq false") .is("<,<'sap.com'>)> eq >") @@ -3932,7 +3935,7 @@ public class TestFullResourcePath { .goParameter(0) .goPath() .first().isUriPathInfoKind(UriResourceKind.it) - .isType(EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameString, false); testFilter.runOnETTwoKeyNav("endswith($it/CollPropertyString,'sap.com')") .is(",<'sap.com'>)>") @@ -3942,17 +3945,17 @@ public class TestFullResourcePath { .goParameter(0) .goPath() .first().isUriPathInfoKind(UriResourceKind.it) - .isType(EdmTechProvider.nameETTwoKeyNav, true) - .n().isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true); + .isType(EntityTypeProvider.nameETTwoKeyNav, true) + .n().isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true); testFilter.runOnETTwoKeyNav("PropertyComplex/PropertyComplex/PropertyInt16 eq $root" + "/ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyInt16") .is("< eq <$root/ESTwoKeyNav/PropertyInt16>>") .root().left() .goPath() - .first().isComplex("PropertyComplex").isType(EdmTechProvider.nameCTPrimComp, false) - .n().isComplex("PropertyComplex").isType(EdmTechProvider.nameCTAllPrim, false) - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .first().isComplex("PropertyComplex").isType(ComplexTypeProvider.nameCTPrimComp, false) + .n().isComplex("PropertyComplex").isType(ComplexTypeProvider.nameCTAllPrim, false) + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .goUpFilterValidator() .root().right() .goPath() @@ -3960,7 +3963,7 @@ public class TestFullResourcePath { .n().isEntitySet("ESTwoKeyNav") .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testFilter.runOnETKeyNav("cast(com.sap.odata.test1.ETBaseTwoKeyNav)") .is(")>") @@ -3968,7 +3971,7 @@ public class TestFullResourcePath { .isMethod(MethodKind.CAST, 1) .isParameterText(0, "") .goParameter(0) - .isTypedLiteral(EdmTechProvider.nameETBaseTwoKeyNav); + .isTypedLiteral(EntityTypeProvider.nameETBaseTwoKeyNav); testFilter.runOnETKeyNav("cast(PropertyComplexTwoPrim,com.sap.odata.test1.CTBase)") .is(",)>") @@ -3977,11 +3980,11 @@ public class TestFullResourcePath { .isParameterText(0, "") .isParameterText(1, "") .goParameter(0).goPath().first() - .isComplex("PropertyComplexTwoPrim").isType(EdmTechProvider.nameCTTwoPrim, false) + .isComplex("PropertyComplexTwoPrim").isType(ComplexTypeProvider.nameCTTwoPrim, false) .goUpFilterValidator() .root() .goParameter(1) - .isTypedLiteral(EdmTechProvider.nameCTBase); + .isTypedLiteral(ComplexTypeProvider.nameCTBase); testFilter.runOnETKeyNav("cast($it,com.sap.odata.test1.CTBase)") .is(",)>") @@ -3990,10 +3993,10 @@ public class TestFullResourcePath { .isParameterText(0, "<$it>") .isParameterText(1, "") .goParameter(0).goPath().first() - .isIt().isType(EdmTechProvider.nameETKeyNav, false) + .isIt().isType(EntityTypeProvider.nameETKeyNav, false) .goUpFilterValidator() .root() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameCTBase); + .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTBase); testFilter.runOnETKeyNav("cast($it,com.sap.odata.test1.CTBase) eq cast($it,com.sap.odata.test1.CTBase)" ) @@ -4003,86 +4006,86 @@ public class TestFullResourcePath { .isParameterText(0, "<$it>") .isParameterText(1, "") .goParameter(0).goPath().first() - .isIt().isType(EdmTechProvider.nameETKeyNav, false) + .isIt().isType(EntityTypeProvider.nameETKeyNav, false) .goUpFilterValidator() .root().left() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameCTBase) + .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTBase) .root().right() .isMethod(MethodKind.CAST, 2) .isParameterText(0, "<$it>") .isParameterText(1, "") .goParameter(0).goPath().first() - .isIt().isType(EdmTechProvider.nameETKeyNav, false) + .isIt().isType(EntityTypeProvider.nameETKeyNav, false) .goUpFilterValidator() .root().right() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameCTBase); + .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTBase); testFilter.runOnInt32("cast(Edm.Int32)") .is(")>") .isMethod(MethodKind.CAST, 1) - .goParameter(0).isTypedLiteral(EdmTechProvider.nameInt32); + .goParameter(0).isTypedLiteral(PropertyProvider.nameInt32); testFilter.runOnDateTimeOffset("cast(Edm.DateTimeOffset)") .is(")>") .isMethod(MethodKind.CAST, 1) - .goParameter(0).isTypedLiteral(EdmTechProvider.nameDateTimeOffset); + .goParameter(0).isTypedLiteral(PropertyProvider.nameDateTimeOffset); testFilter.runOnDuration("cast(Edm.Duration)") .is(")>") .isMethod(MethodKind.CAST, 1) - .goParameter(0).isTypedLiteral(EdmTechProvider.nameDuration); + .goParameter(0).isTypedLiteral(PropertyProvider.nameDuration); testFilter.runOnTimeOfDay("cast(Edm.TimeOfDay)") .is(")>") .isMethod(MethodKind.CAST, 1) - .goParameter(0).isTypedLiteral(EdmTechProvider.nameTimeOfDay); + .goParameter(0).isTypedLiteral(PropertyProvider.nameTimeOfDay); testFilter.runOnETKeyNav("cast(CollPropertyInt16,Edm.Int32)") .is(",)>") .isMethod(MethodKind.CAST, 2) .goParameter(0).goPath().first() - .isPrimitiveProperty("CollPropertyInt16", EdmTechProvider.nameInt16, true) + .isPrimitiveProperty("CollPropertyInt16", PropertyProvider.nameInt16, true) .goUpFilterValidator().root() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameInt32); + .goParameter(1).isTypedLiteral(PropertyProvider.nameInt32); testFilter.runOnETTwoKeyNav( "cast(PropertyComplex/PropertyComplex/PropertyDateTimeOffset,Edm.DateTimeOffset)") .is(",)>") .isMethod(MethodKind.CAST, 2) .goParameter(0).goPath() - .first().isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) - .n().isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false) - .n().isPrimitiveProperty("PropertyDateTimeOffset", EdmTechProvider.nameDateTimeOffset, false) + .first().isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) + .n().isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false) + .n().isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset, false) .goUpFilterValidator().root() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameDateTimeOffset); + .goParameter(1).isTypedLiteral(PropertyProvider.nameDateTimeOffset); testFilter.runOnETTwoKeyNav("cast(PropertyComplex/PropertyComplex/PropertyDuration,Edm.Duration)") .is(",)>") .isMethod(MethodKind.CAST, 2) .goParameter(0).goPath() - .first().isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) - .n().isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false) - .n().isPrimitiveProperty("PropertyDuration", EdmTechProvider.nameDuration, false) + .first().isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) + .n().isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false) + .n().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false) .goUpFilterValidator().root() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameDuration); + .goParameter(1).isTypedLiteral(PropertyProvider.nameDuration); testFilter.runOnETTwoKeyNav("cast(PropertyComplex/PropertyComplex/PropertyTimeOfDay,Edm.TimeOfDay)") .is(",)>") .isMethod(MethodKind.CAST, 2) .goParameter(0).goPath() - .first().isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) - .n().isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false) - .n().isPrimitiveProperty("PropertyTimeOfDay", EdmTechProvider.nameTimeOfDay, false) + .first().isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) + .n().isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false) + .n().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false) .goUpFilterValidator().root() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameTimeOfDay); + .goParameter(1).isTypedLiteral(PropertyProvider.nameTimeOfDay); testFilter.runOnETKeyNav("cast(PropertyComplexAllPrim,com.sap.odata.test1.CTTwoPrim)") .is(",)>") .isMethod(MethodKind.CAST, 2) .goParameter(0).goPath() - .first().isComplexProperty("PropertyComplexAllPrim", EdmTechProvider.nameCTAllPrim, false) + .first().isComplexProperty("PropertyComplexAllPrim", ComplexTypeProvider.nameCTAllPrim, false) .goUpFilterValidator().root() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameCTTwoPrim); + .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim); // testFilter.runOnETKeyNav(" Xcast(PropertyComplexTwoPrim,com.sap.odata.test1.CTAllPrim)"); @@ -4090,9 +4093,9 @@ public class TestFullResourcePath { .is(",)>") .isMethod(MethodKind.CAST, 2) .goParameter(0).goPath() - .first().isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) + .first().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) .goUpFilterValidator().root() - .goParameter(1).isTypedLiteral(EdmTechProvider.nameETKeyPrimNav); + .goParameter(1).isTypedLiteral(EntityTypeProvider.nameETKeyPrimNav); testFilter.runOnETKeyNavEx("cast(NavPropertyETKeyPrimNavOne,com.sap.odata.test1.ETKeyNav)").isExSemantic(0); testFilter.runOnETKeyNav("any()") @@ -4111,20 +4114,20 @@ public class TestFullResourcePath { .isBinary(BinaryOperatorKind.EQ) .left().goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETKeyNav, false) - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isType(EntityTypeProvider.nameETKeyNav, false) + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyString eq 'SomeString')") .is(" eq <'SomeString'>>>>") .root().goPath() - .first().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) + .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .isBinary(BinaryOperatorKind.EQ) .left().goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); // TODO planned: lambda does not check if the previous path segment is a collection // testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavOne/any(d:d/PropertyString eq 'SomeString')"); @@ -4135,36 +4138,36 @@ public class TestFullResourcePath { testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavOne/CollPropertyString/any(d:d eq 'SomeString')") .is(" eq <'SomeString'>>>>") .root().goPath() - .first().isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) - .n().isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true) + .first().isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) + .n().isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true) .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .isBinary(BinaryOperatorKind.EQ) .left().goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameString, false); testFilter.runOnETKeyNav(" NavPropertyETTwoKeyNavOne/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()" + "/any(d:d/PropertyComplex/PropertyInt16 eq 6)") .is(" eq <6>>>>") .root().goPath() - .first().isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) + .first().isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) .n().isFunction("BFCETTwoKeyNavRTESTwoKeyNav") .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .isBinary(BinaryOperatorKind.EQ) .left().goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/any" + "(e:e/CollPropertyString eq 'SomeString'))") .is(" eq <1>> or " + " eq <'SomeString'>>>>>>>") .root().goPath() - .first().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) + .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .root().isBinary(BinaryOperatorKind.OR) @@ -4173,26 +4176,26 @@ public class TestFullResourcePath { .left() .goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .goUpFilterValidator() .root().right() .goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .root().left().goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .n().isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true); + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .n().isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true); testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/CollPropertyString/any" + "(e:e eq 'SomeString'))") .is(" eq <1>> or " + " eq <'SomeString'>>>>>>>") .root().goPath() - .first().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) + .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .root().isBinary(BinaryOperatorKind.OR) @@ -4201,19 +4204,19 @@ public class TestFullResourcePath { .left() .goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .goUpFilterValidator() .root().right() .goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .n().isType(EdmTechProvider.nameString, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .n().isType(PropertyProvider.nameString, true) .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .root().left().goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameString, false); testFilter .runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyString eq 'SomeString' and d/CollPropertyString/any" @@ -4221,7 +4224,7 @@ public class TestFullResourcePath { .is(" eq <'SomeString'>> and " + " eq >>>>>>") .root().goPath() - .first().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) + .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .root().isBinary(BinaryOperatorKind.AND) @@ -4230,23 +4233,23 @@ public class TestFullResourcePath { .left() .goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .goUpFilterValidator() .root().right() .goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .n().isType(EdmTechProvider.nameString, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .n().isType(PropertyProvider.nameString, true) .n().isUriPathInfoKind(UriResourceKind.lambdaAny) .goLambdaExpression() .root().left().goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .isType(EdmTechProvider.nameString, false) + .isType(PropertyProvider.nameString, false) .goUpFilterValidator() .root().right().goPath() .first().isUriPathInfoKind(UriResourceKind.lambdaVariable) - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); } @@ -4257,14 +4260,14 @@ public class TestFullResourcePath { .is(")>") .root() .isMethod(MethodKind.ISOF, 1) - .goParameter(0).isTypedLiteral(EdmTechProvider.nameETTwoKeyNav); + .goParameter(0).isTypedLiteral(EntityTypeProvider.nameETTwoKeyNav); testFilter.runOnETKeyNav("isof(com.sap.odata.test1.ETBaseTwoKeyNav) eq true") .is("<)> eq >") .root().isBinary(BinaryOperatorKind.EQ) .left() .isMethod(MethodKind.ISOF, 1) - .goParameter(0).isTypedLiteral(EdmTechProvider.nameETBaseTwoKeyNav); + .goParameter(0).isTypedLiteral(EntityTypeProvider.nameETBaseTwoKeyNav); testFilter .runOnETKeyNav("isof(com.sap.odata.test1.ETBaseTwoKeyNav) eq true and PropertyComplex/PropertyInt16 eq 1") @@ -4272,40 +4275,40 @@ public class TestFullResourcePath { .root().isBinary(BinaryOperatorKind.AND) .left().isBinary(BinaryOperatorKind.EQ) .left().isMethod(MethodKind.ISOF, 1) - .goParameter(0).isTypedLiteral(EdmTechProvider.nameETBaseTwoKeyNav); + .goParameter(0).isTypedLiteral(EntityTypeProvider.nameETBaseTwoKeyNav); testFilter.runOnETKeyNav("isof(NavPropertyETKeyNavOne, com.sap.odata.test1.ETKeyNav) eq true") .is("<,)> eq >") .root().isBinary(BinaryOperatorKind.EQ) .left().isMethod(MethodKind.ISOF, 2) - .goParameter(0).goPath().isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) + .goParameter(0).goPath().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) .goUpFilterValidator() - .root().left().goParameter(1).isTypedLiteral(EdmTechProvider.nameETKeyNav); + .root().left().goParameter(1).isTypedLiteral(EntityTypeProvider.nameETKeyNav); testFilter.runOnETKeyNav("isof(PropertyComplexTwoPrim,com.sap.odata.test1.CTTwoPrim)") .is(",)>") .root().isMethod(MethodKind.ISOF, 2) .goParameter(0).goPath().isComplex("PropertyComplexTwoPrim").goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameCTTwoPrim); + .root().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim); testFilter.runOnETKeyNav("isof(PropertyComplexTwoPrim,com.sap.odata.test1.CTTwoBase)") .is(",)>") .root().isMethod(MethodKind.ISOF, 2) .goParameter(0).goPath().isComplex("PropertyComplexTwoPrim").goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameCTTwoBase); + .root().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoBase); testFilter.runOnETKeyNav("isof(PropertyComplexTwoPrim,com.sap.odata.test1.CTTwoPrim) eq true") .is("<,)> eq >") .root().left().isMethod(MethodKind.ISOF, 2) .goParameter(0).goPath().isComplex("PropertyComplexTwoPrim").goUpFilterValidator() - .root().left().goParameter(1).isTypedLiteral(EdmTechProvider.nameCTTwoPrim); + .root().left().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim); testFilter.runOnETKeyNav("isof($it,com.sap.odata.test1.CTTwoPrim)") .is(",)>") .root() .isMethod(MethodKind.ISOF, 2) .goParameter(0).goPath().isIt().goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameCTTwoPrim); + .root().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim); testFilter.runOnETKeyNav("isof($it,com.sap.odata.test1.CTTwoBase) eq false") .is("<,)> eq >") @@ -4313,7 +4316,7 @@ public class TestFullResourcePath { .root().left() .isMethod(MethodKind.ISOF, 2) .goParameter(0).goPath().isIt().goUpFilterValidator() - .root().left().goParameter(1).isTypedLiteral(EdmTechProvider.nameCTTwoBase); + .root().left().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoBase); testFilter.runOnETKeyNav("isof(PropertyComplex/PropertyInt16,Edm.Int32)") .is(",)>") @@ -4321,9 +4324,9 @@ public class TestFullResourcePath { .isMethod(MethodKind.ISOF, 2) .goParameter(0).goPath() .first().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameInt32); + .root().goParameter(1).isTypedLiteral(PropertyProvider.nameInt32); testFilter.runOnETTwoKeyNav("isof(PropertyComplex/PropertyComplex/PropertyDateTimeOffset,Edm.DateTimeOffset)") .is(",)>") @@ -4332,9 +4335,9 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyDateTimeOffset", EdmTechProvider.nameDateTimeOffset, false) + .n().isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset, false) .goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameDateTimeOffset); + .root().goParameter(1).isTypedLiteral(PropertyProvider.nameDateTimeOffset); testFilter.runOnETTwoKeyNav("isof(PropertyComplex/PropertyComplex/PropertyTimeOfDay,Edm.TimeOfDay)") .is(",)>") @@ -4343,9 +4346,9 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyTimeOfDay", EdmTechProvider.nameTimeOfDay, false) + .n().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false) .goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameTimeOfDay); + .root().goParameter(1).isTypedLiteral(PropertyProvider.nameTimeOfDay); testFilter.runOnETTwoKeyNav(" isof(PropertyComplex/PropertyComplex/PropertyDuration,Edm.Duration)") .is(",)>") @@ -4354,9 +4357,9 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyDuration", EdmTechProvider.nameDuration, false) + .n().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false) .goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameDuration); + .root().goParameter(1).isTypedLiteral(PropertyProvider.nameDuration); testFilter.runOnETTwoKeyNav("isof(PropertyComplex/PropertyComplex/PropertyString,Edm.String)") .is(",)>") @@ -4365,9 +4368,9 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameString); + .root().goParameter(1).isTypedLiteral(PropertyProvider.nameString); testFilter.runOnETTwoKeyNav("isof(PropertyComplex/PropertyComplex/PropertyString,Edm.Guid)") .is(",)>") @@ -4376,9 +4379,9 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .goUpFilterValidator() - .root().goParameter(1).isTypedLiteral(EdmTechProvider.nameGuid); + .root().goParameter(1).isTypedLiteral(PropertyProvider.nameGuid); } @Test @@ -4387,19 +4390,19 @@ public class TestFullResourcePath { testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String1'") .is("< has >>") .isBinary(BinaryOperatorKind.HAS) - .root().left().goPath().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString) + .root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .goUpFilterValidator() - .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String1")); + .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1")); testFilter.runOnETTwoKeyNav("PropertyComplexEnum/PropertyEnumString has com.sap.odata.test1.ENString'String2'") .is("< has >>") .isBinary(BinaryOperatorKind.HAS) .root().left().goPath() .first().isComplex("PropertyComplexEnum") - .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString) - .isType(EdmTechProvider.nameENString) + .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) + .isType(EnumTypeProvider.nameENString) .goUpFilterValidator() - .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String2")); + .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2")); testFilter.runOnETTwoKeyNav( "PropertyComplexEnum/PropertyEnumString has com.sap.odata.test1.ENString'String2' eq true") @@ -4409,34 +4412,34 @@ public class TestFullResourcePath { .isBinary(BinaryOperatorKind.HAS) .root().left().left().goPath() .first().isComplex("PropertyComplexEnum") - .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString) + .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .goUpFilterValidator() - .root().left().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String2")); + .root().left().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2")); testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String3'") .is("< has >>") .isBinary(BinaryOperatorKind.HAS) .root().left().goPath() - .first().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString) - .isType(EdmTechProvider.nameENString) + .first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) + .isType(EnumTypeProvider.nameENString) .goUpFilterValidator() - .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String3")); + .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3")); testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String,String3'") .is("< has >>") .isBinary(BinaryOperatorKind.HAS) .root().left().goPath() - .first().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString) - .isType(EdmTechProvider.nameENString) + .first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) + .isType(EnumTypeProvider.nameENString) .goUpFilterValidator() - .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String", "String3")); + .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String", "String3")); testFilter.runOnETTwoKeyNav("PropertyEnumString has null") .is("< has >") .root() .isBinary(BinaryOperatorKind.HAS) .root().left().goPath() - .first().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString).goUpFilterValidator() + .first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator() .root().right().isNull(); testFilter.runOnETTwoKeyNav("endswith(PropertyComplex/PropertyComplex/PropertyString,'dorf')") @@ -4445,7 +4448,7 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .root().goParameter(1).isLiteral("'dorf'"); testFilter.runOnETTwoKeyNav("endswith(PropertyComplex/PropertyComplex/PropertyString,'dorf') eq true") @@ -4455,7 +4458,7 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .root().left().goParameter(1).isLiteral("'dorf'"); testFilter.runOnETTwoKeyNav("endswith('Walldorf','dorf')") @@ -4476,7 +4479,7 @@ public class TestFullResourcePath { .isMethod(MethodKind.STARTSWITH, 2) .goParameter(0).goPath() .first().isComplex("PropertyComplexAllPrim") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .root().goParameter(1).isLiteral("'Wall'"); testFilter.runOnETKeyNav("startswith(PropertyComplexAllPrim/PropertyString,'Wall') eq true") @@ -4485,7 +4488,7 @@ public class TestFullResourcePath { .left().isMethod(MethodKind.STARTSWITH, 2) .goParameter(0).goPath() .first().isComplex("PropertyComplexAllPrim") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .root().left().goParameter(1).isLiteral("'Wall'"); testFilter.runOnETKeyNav("startswith('Walldorf','Wall')") @@ -4507,7 +4510,7 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .root().goParameter(1).isLiteral("'Wall'"); testFilter.runOnETTwoKeyNav("contains(PropertyComplex/PropertyComplex/PropertyString,'Wall') eq true") @@ -4517,7 +4520,7 @@ public class TestFullResourcePath { .goParameter(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .root().left().goParameter(1).isLiteral("'Wall'"); testFilter.runOnETTwoKeyNav("contains('Walldorf','Wall')") @@ -4542,7 +4545,7 @@ public class TestFullResourcePath { testFilter.runOnETAllPrim("PropertyBoolean eq true") .is("< eq >") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyBoolean", EdmTechProvider.nameBoolean, false) + .root().left().goPath().isPrimitiveProperty("PropertyBoolean", PropertyProvider.nameBoolean, false) .goUpFilterValidator() .root().right().isTrue(); @@ -4552,28 +4555,28 @@ public class TestFullResourcePath { testFilter.runOnETAllPrim("PropertyDecimal eq 1.25") .is("< eq <1.25>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyDecimal", EdmTechProvider.nameDecimal, false) + .root().left().goPath().isPrimitiveProperty("PropertyDecimal", PropertyProvider.nameDecimal, false) .goUpFilterValidator() .root().right().isLiteral("1.25"); testFilter.runOnETAllPrim("PropertyDouble eq 1.5") .is("< eq <1.5>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyDouble", EdmTechProvider.nameDouble, false) + .root().left().goPath().isPrimitiveProperty("PropertyDouble", PropertyProvider.nameDouble, false) .goUpFilterValidator() .root().right().isLiteral("1.5"); testFilter.runOnETAllPrim("PropertySingle eq 1.5") .is("< eq <1.5>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertySingle", EdmTechProvider.nameSingle, false) + .root().left().goPath().isPrimitiveProperty("PropertySingle", PropertyProvider.nameSingle, false) .goUpFilterValidator() .root().right().isLiteral("1.5"); testFilter.runOnETAllPrim("PropertySByte eq -128") .is("< eq <-128>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertySByte", EdmTechProvider.nameSByte, false) + .root().left().goPath().isPrimitiveProperty("PropertySByte", PropertyProvider.nameSByte, false) .goUpFilterValidator() .root().right().isLiteral("-128"); @@ -4581,34 +4584,34 @@ public class TestFullResourcePath { .is("< eq <255>>") .isBinary(BinaryOperatorKind.EQ) .root().left().goPath().isPrimitiveProperty("PropertyByte", - EdmTechProvider.nameByte, false).goUpFilterValidator() + PropertyProvider.nameByte, false).goUpFilterValidator() .root().right().isLiteral("255"); testFilter.runOnETAllPrim("PropertyInt16 eq 32767") .is("< eq <32767>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .root().left().goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .goUpFilterValidator() .root().right().isLiteral("32767"); testFilter.runOnETAllPrim("PropertyInt32 eq 2147483647") .is("< eq <2147483647>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyInt32", EdmTechProvider.nameInt32, false) + .root().left().goPath().isPrimitiveProperty("PropertyInt32", PropertyProvider.nameInt32, false) .goUpFilterValidator() .root().right().isLiteral("2147483647"); testFilter.runOnETAllPrim("PropertyInt64 eq 9223372036854775807") .is("< eq <9223372036854775807>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyInt64", EdmTechProvider.nameInt64, false) + .root().left().goPath().isPrimitiveProperty("PropertyInt64", PropertyProvider.nameInt64, false) .goUpFilterValidator() .root().right().isLiteral("9223372036854775807"); testFilter.runOnETAllPrim("PropertyDate eq 2013-09-25") .is("< eq <2013-09-25>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) + .root().left().goPath().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false) .goUpFilterValidator() .root().right().isLiteral("2013-09-25"); @@ -4616,69 +4619,69 @@ public class TestFullResourcePath { .is("< eq <2013-09-25T12:34:56.123456789012-10:24>>") .isBinary(BinaryOperatorKind.EQ) .root().left().goPath() - .isPrimitiveProperty("PropertyDateTimeOffset", EdmTechProvider.nameDateTimeOffset, false) + .isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset, false) .goUpFilterValidator() .root().right().isLiteral("2013-09-25T12:34:56.123456789012-10:24"); testFilter.runOnETAllPrim("PropertyDuration eq duration'P10DT5H34M21.123456789012S'") .is("< eq >") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyDuration", EdmTechProvider.nameDuration, false) + .root().left().goPath().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false) .goUpFilterValidator() .root().right().isLiteral("duration'P10DT5H34M21.123456789012S'"); testFilter.runOnETAllPrim("PropertyGuid eq 005056A5-09B1-1ED3-89BD-FB81372CCB33") .is("< eq <005056A5-09B1-1ED3-89BD-FB81372CCB33>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyGuid", EdmTechProvider.nameGuid, false) + .root().left().goPath().isPrimitiveProperty("PropertyGuid", PropertyProvider.nameGuid, false) .goUpFilterValidator() .root().right().isLiteral("005056A5-09B1-1ED3-89BD-FB81372CCB33"); testFilter.runOnETAllPrim("PropertyString eq 'somestring'") .is("< eq <'somestring'>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .root().left().goPath().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .goUpFilterValidator() .root().right().isLiteral("'somestring'"); testFilter.runOnETAllPrim("PropertyTimeOfDay eq 12:34:55.12345678901") .is("< eq <12:34:55.12345678901>>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isPrimitiveProperty("PropertyTimeOfDay", EdmTechProvider.nameTimeOfDay, false) + .root().left().goPath().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false) .goUpFilterValidator() .root().right().isLiteral("12:34:55.12345678901"); testFilter.runOnETTwoKeyNav("PropertyEnumString eq com.sap.odata.test1.ENString'String1'") .is("< eq >>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString) + .root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .goUpFilterValidator() - .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String1")); + .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1")); testFilter.runOnETTwoKeyNav("PropertyEnumString eq com.sap.odata.test1.ENString'String2'") .is("< eq >>") .isBinary(BinaryOperatorKind.EQ) - .root().left().goPath().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString) + .root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .goUpFilterValidator() - .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String2")); + .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2")); testFilter.runOnETTwoKeyNav("PropertyComplexEnum/PropertyEnumString eq com.sap.odata.test1.ENString'String3'") .is("< eq >>") .isBinary(BinaryOperatorKind.EQ) .root().left().goPath() .first().isComplex("PropertyComplexEnum") - .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString).goUpFilterValidator() - .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String3")); + .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator() + .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3")); testFilter.runOnETTwoKeyNav("PropertyComplexEnum/PropertyEnumString eq PropertyComplexEnum/PropertyEnumString") .is("< eq >") .isBinary(BinaryOperatorKind.EQ) .root().left().goPath() .first().isComplex("PropertyComplexEnum") - .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString).goUpFilterValidator() + .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator() .root().right().goPath() .first().isComplex("PropertyComplexEnum") - .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString).goUpFilterValidator(); + .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator(); } @@ -4715,7 +4718,7 @@ public class TestFullResourcePath { .goOrder(0).right().isLiteral("'SomeString'") .isSortOrder(1, false) .goOrder(1).isBinary(BinaryOperatorKind.EQ).left().goPath() - .first().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .first().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .goOrder(1).right().isLiteral("'1'"); testFilter.runOrderByOnETTwoKeyNav("PropertyComplex/PropertyComplex/PropertyDate eq " @@ -4724,26 +4727,26 @@ public class TestFullResourcePath { .goOrder(0).isBinary(BinaryOperatorKind.EQ).left().goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) + .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false) .goUpFilterValidator() .goOrder(0).right().goPath() .first().isUriPathInfoKind(UriResourceKind.root) .n().isEntitySet("ESTwoKeyNav") .n().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false); + .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false); testFilter.runOrderByOnETTwoKeyNav("PropertyString") .isSortOrder(0, false) .goOrder(0).goPath() - .first().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .first().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOrderByOnETTwoKeyNav("PropertyComplex/PropertyComplex/PropertyDate") .isSortOrder(0, false) .goOrder(0).goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false); + .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false); testFilter.runOrderByOnETTwoKeyNav("PropertyComplex/PropertyComplex/PropertyDate " + "eq 2013-11-12 desc, PropertyString eq 'SomeString' desc") @@ -4752,10 +4755,10 @@ public class TestFullResourcePath { .left().goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false).goUpFilterValidator() .goOrder(0).right().isLiteral("2013-11-12") .isSortOrder(1, true) - .goOrder(1).left().goPath().first().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .goOrder(1).left().goPath().first().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .goUpFilterValidator() .goOrder(1).right().isLiteral("'SomeString'"); @@ -4777,235 +4780,235 @@ public class TestFullResourcePath { .goOrder(1).isBinary(BinaryOperatorKind.EQ) .left().goPath() .first().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false).goUpFilterValidator() + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false).goUpFilterValidator() .goOrder(1).right().isLiteral("1"); testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavOne") .isSortOrder(0, false).goOrder(0).goPath() - .first().isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false); + .first().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false); testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavOne/PropertyString") .isSortOrder(0, false).goOrder(0).goPath() - .first().isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .first().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavOne/PropertyComplex") .isSortOrder(0, false).goOrder(0).goPath() - .first().isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) + .first().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) .n().isComplex("PropertyComplex"); testFilter.runOrderByOnETTwoKeyNav("PropertyComplex/PropertyComplex/PropertyInt16 eq 1") .isSortOrder(0, false).goOrder(0).left().goPath() .first().isComplex("PropertyComplex") .n().isComplex("PropertyComplex") - .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavMany(1)/NavPropertyETTwoKeyNavMany(PropertyString='2')" + "/PropertyString eq 'SomeString'") .isSortOrder(0, false).goOrder(0).left().goPath() - .first().isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) - .n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .first().isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) + .n().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavMany(1)/NavPropertyETTwoKeyNavMany(PropertyString='2')" + "/PropertyString eq 'SomeString1' desc,PropertyString eq 'SomeString2' asc") .isSortOrder(0, true).goOrder(0).left().goPath() - .first().isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) - .n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) - .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false).goUpFilterValidator() + .first().isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) + .n().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) + .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator() .isSortOrder(1, false).goOrder(1).left().goPath() - .first().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .first().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testFilter.runOrderByOnETAllPrim("PropertyBoolean eq true") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBoolean", EdmTechProvider.nameBoolean, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBoolean", PropertyProvider.nameBoolean, false) .goUpFilterValidator() .goOrder(0).right().isTrue(); testFilter.runOrderByOnETAllPrim("PropertyBoolean eq true desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBoolean", EdmTechProvider.nameBoolean, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBoolean", PropertyProvider.nameBoolean, false) .goUpFilterValidator() .goOrder(0).right().isTrue(); testFilter.runOrderByOnETAllPrim(encode("PropertyDouble eq 3.5E+38")) .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDouble", EdmTechProvider.nameDouble, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDouble", PropertyProvider.nameDouble, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("3.5E+38"); testFilter.runOrderByOnETAllPrim(encode("PropertyDouble eq 3.5E+38 desc")).isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDouble", EdmTechProvider.nameDouble, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDouble", PropertyProvider.nameDouble, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("3.5E+38"); testFilter.runOrderByOnETAllPrim("PropertySingle eq 1.5") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertySingle", EdmTechProvider.nameSingle, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertySingle", PropertyProvider.nameSingle, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("1.5"); testFilter.runOrderByOnETAllPrim("PropertySingle eq 1.5 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertySingle", EdmTechProvider.nameSingle, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertySingle", PropertyProvider.nameSingle, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("1.5"); testFilter.runOrderByOnETAllPrim("PropertySByte eq -128") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertySByte", EdmTechProvider.nameSByte, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertySByte", PropertyProvider.nameSByte, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("-128"); testFilter.runOrderByOnETAllPrim("PropertySByte eq -128 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertySByte", EdmTechProvider.nameSByte, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertySByte", PropertyProvider.nameSByte, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("-128"); testFilter.runOrderByOnETAllPrim("PropertyByte eq 255") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyByte", EdmTechProvider.nameByte, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("255"); testFilter.runOrderByOnETAllPrim("PropertyByte eq 255 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyByte", EdmTechProvider.nameByte, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("255"); testFilter.runOrderByOnETAllPrim("PropertyInt16 eq 32767") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("32767"); testFilter.runOrderByOnETAllPrim("PropertyInt16 eq 32767 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("32767"); testFilter.runOrderByOnETAllPrim("PropertyInt32 eq 2147483647") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt32", EdmTechProvider.nameInt32, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt32", PropertyProvider.nameInt32, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("2147483647"); testFilter.runOrderByOnETAllPrim("PropertyInt32 eq 2147483647 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt32", EdmTechProvider.nameInt32, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt32", PropertyProvider.nameInt32, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("2147483647"); testFilter.runOrderByOnETAllPrim("PropertyInt64 eq 9223372036854775807") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt64", EdmTechProvider.nameInt64, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt64", PropertyProvider.nameInt64, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("9223372036854775807"); testFilter.runOrderByOnETAllPrim("PropertyInt64 eq 9223372036854775807 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt64", EdmTechProvider.nameInt64, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt64", PropertyProvider.nameInt64, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("9223372036854775807"); testFilter.runOrderByOnETAllPrim("PropertyBinary eq binary'0FAB7B'") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBinary", EdmTechProvider.nameBinary, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBinary", PropertyProvider.nameBinary, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("binary'0FAB7B'"); testFilter.runOrderByOnETAllPrim("PropertyBinary eq binary'0FAB7B' desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBinary", EdmTechProvider.nameBinary, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBinary", PropertyProvider.nameBinary, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("binary'0FAB7B'"); testFilter.runOrderByOnETAllPrim("PropertyDate eq 2013-09-25") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("2013-09-25"); testFilter.runOrderByOnETAllPrim("PropertyDate eq 2013-09-25 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("2013-09-25"); testFilter.runOrderByOnETAllPrim("PropertyDateTimeOffset eq 2013-09-25T12:34:56.123456789012-10:24") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDateTimeOffset", EdmTechProvider.nameDateTimeOffset, + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("2013-09-25T12:34:56.123456789012-10:24"); testFilter.runOrderByOnETAllPrim("PropertyDateTimeOffset eq 2013-09-25T12:34:56.123456789012-10:24 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDateTimeOffset", EdmTechProvider.nameDateTimeOffset, + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("2013-09-25T12:34:56.123456789012-10:24"); testFilter.runOrderByOnETAllPrim("PropertyDuration eq duration'P10DT5H34M21.123456789012S'") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDuration", EdmTechProvider.nameDuration, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("duration'P10DT5H34M21.123456789012S'"); testFilter.runOrderByOnETAllPrim("PropertyDuration eq duration'P10DT5H34M21.123456789012S' desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDuration", EdmTechProvider.nameDuration, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("duration'P10DT5H34M21.123456789012S'"); testFilter.runOrderByOnETAllPrim("PropertyGuid eq 005056A5-09B1-1ED3-89BD-FB81372CCB33") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyGuid", EdmTechProvider.nameGuid, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyGuid", PropertyProvider.nameGuid, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("005056A5-09B1-1ED3-89BD-FB81372CCB33"); testFilter.runOrderByOnETAllPrim("PropertyGuid eq 005056A5-09B1-1ED3-89BD-FB81372CCB33 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyGuid", EdmTechProvider.nameGuid, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyGuid", PropertyProvider.nameGuid, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("005056A5-09B1-1ED3-89BD-FB81372CCB33"); testFilter.runOrderByOnETAllPrim("PropertyString eq 'somestring'") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("'somestring'"); testFilter.runOrderByOnETAllPrim("PropertyString eq 'somestring' desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("'somestring'"); testFilter.runOrderByOnETAllPrim("PropertyTimeOfDay eq 12:34:55.123456789012") .isSortOrder(0, false) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyTimeOfDay", EdmTechProvider.nameTimeOfDay, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("12:34:55.123456789012"); testFilter.runOrderByOnETAllPrim("PropertyTimeOfDay eq 12:34:55.123456789012 desc") .isSortOrder(0, true) - .goOrder(0).left().goPath().isPrimitiveProperty("PropertyTimeOfDay", EdmTechProvider.nameTimeOfDay, false) + .goOrder(0).left().goPath().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false) .goUpFilterValidator() .goOrder(0).right().isLiteral("12:34:55.123456789012"); testFilter.runOrderByOnETTwoKeyNav("PropertyEnumString eq com.sap.odata.test1.ENString'String1'") .isSortOrder(0, false) .goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator() - .goOrder(0).right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String1")); + .goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1")); testFilter.runOrderByOnETTwoKeyNav("PropertyEnumString eq com.sap.odata.test1.ENString'String1' desc") .isSortOrder(0, true) .goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator() - .goOrder(0).right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String1")); + .goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1")); testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 1").isExSyntax(0); testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16, PropertyInt32 PropertyDuration").isExSyntax(0); diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java index 7a510a175..e8aa9cecd 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java @@ -1,25 +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.server.core.uri.antlr; import org.antlr.v4.runtime.Lexer; -import org.apache.olingo.server.core.uri.antlr.UriLexer; import org.apache.olingo.server.core.uri.testutil.TokenValidator; import org.junit.Test; @@ -72,17 +71,17 @@ public class TestLexer { test.run("$top=1").isAllText("$top=1").isType(UriLexer.TOP); test.run("$top=2").isAllText("$top=2").isType(UriLexer.TOP); test.run("$top=123").isAllText("$top=123").isType(UriLexer.TOP); - + test.run("$levels=1").isAllText("$levels=1").isType(UriLexer.LEVELS); test.run("$levels=2").isAllText("$levels=2").isType(UriLexer.LEVELS); test.run("$levels=123").isAllText("$levels=123").isType(UriLexer.LEVELS); test.run("$levels=max").isAllText("$levels=max").isType(UriLexer.LEVELS); - + test.run("$format=atom").isAllText("$format=atom").isType(UriLexer.FORMAT); test.run("$format=json").isAllText("$format=json").isType(UriLexer.FORMAT); test.run("$format=xml").isAllText("$format=xml").isType(UriLexer.FORMAT); test.run("$format=abc/def").isAllText("$format=abc/def").isType(UriLexer.FORMAT); - + test.run("$id=123").isAllText("$id=123").isType(UriLexer.ID); test.run("$id=ABC").isAllText("$id=ABC").isType(UriLexer.ID); @@ -120,7 +119,6 @@ public class TestLexer { } - // ;------------------------------------------------------------------------------ // ; 7. Literal Data Values // ;------------------------------------------------------------------------------ @@ -226,7 +224,6 @@ public class TestLexer { } - @Test public void testDelims() { String reserved = "/"; 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 fd4173f6b..50b7a5d85 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 @@ -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. */ @@ -28,8 +28,10 @@ import org.apache.olingo.server.api.uri.UriInfoKind; import org.apache.olingo.server.api.uri.UriResourceKind; import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechProvider; import org.apache.olingo.server.core.testutil.EdmTechTestProvider; +import org.apache.olingo.server.core.testutil.techprovider.ComplexTypeProvider; +import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; +import org.apache.olingo.server.core.testutil.techprovider.PropertyProvider; import org.apache.olingo.server.core.uri.parser.UriParserException; import org.apache.olingo.server.core.uri.testutil.FilterValidator; import org.apache.olingo.server.core.uri.testutil.ResourceValidator; @@ -104,57 +106,57 @@ public class TestUriParserImpl { testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()") .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameString, false); // returning collection of primitive testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()") .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameString, true); + .isType(PropertyProvider.nameString, true); // returning single complex testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()") .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameCTTwoPrim, false); + .isType(ComplexTypeProvider.nameCTTwoPrim, false); // returning collection of complex testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()") .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameCTTwoPrim, true); + .isType(ComplexTypeProvider.nameCTTwoPrim, true); // returning single entity testRes.run( esTwoKeyNav + "/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()") .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameETTwoKeyNav, false); + .isType(EntityTypeProvider.nameETTwoKeyNav, false); // returning collection of entity (aka entitySet) testRes.run(esTwoKeyNav + "/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()") .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .at(1) .isUriPathInfoKind(UriResourceKind.function) - .isType(EdmTechProvider.nameETTwoKeyNav, true); + .isType(EntityTypeProvider.nameETTwoKeyNav, true); } @Test @@ -164,31 +166,31 @@ public class TestUriParserImpl { .first() .isActionImport("AIRTPrimParam") .isAction("UARTPrimParam") - .isType(EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameString, false); testRes.run("AIRTPrimCollParam").isKind(UriInfoKind.resource) .first() .isActionImport("AIRTPrimCollParam") .isAction("UARTPrimCollParam") - .isType(EdmTechProvider.nameString, true); + .isType(PropertyProvider.nameString, true); testRes.run("AIRTCompParam").isKind(UriInfoKind.resource) .first() .isActionImport("AIRTCompParam") .isAction("UARTCompParam") - .isType(EdmTechProvider.nameCTTwoPrim, false); + .isType(ComplexTypeProvider.nameCTTwoPrim, false); testRes.run("AIRTCompCollParam").isKind(UriInfoKind.resource) .first() .isActionImport("AIRTCompCollParam") .isAction("UARTCompCollParam") - .isType(EdmTechProvider.nameCTTwoPrim, true); + .isType(ComplexTypeProvider.nameCTTwoPrim, true); testRes.run("AIRTETParam").isKind(UriInfoKind.resource) .first() .isActionImport("AIRTETParam") .isAction("UARTETParam") - .isType(EdmTechProvider.nameETTwoKeyTwoPrim, false); + .isType(EntityTypeProvider.nameETTwoKeyTwoPrim, false); testUri.runEx("AIRTPrimParam/invalidElement").isExSemantic(0); } @@ -200,23 +202,23 @@ public class TestUriParserImpl { testRes.run("ESAllPrim/$count") .at(0) .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETAllPrim,true) + .isType(EntityTypeProvider.nameETAllPrim, true) .at(1) .isUriPathInfoKind(UriResourceKind.count); // count on collection of complex testRes.run("ESKeyNav(1)/CollPropertyComplex/$count") .at(0) - .isType(EdmTechProvider.nameETKeyNav) + .isType(EntityTypeProvider.nameETKeyNav) .at(1) - .isType(EdmTechProvider.nameCTPrimComp, true) + .isType(ComplexTypeProvider.nameCTPrimComp, true) .at(2) .isUriPathInfoKind(UriResourceKind.count); // count on collection of primitive testRes.run("ESCollAllPrim(1)/CollPropertyString/$count") .at(1) - .isType(EdmTechProvider.nameString, true) + .isType(PropertyProvider.nameString, true) .at(2) .isUriPathInfoKind(UriResourceKind.count); } @@ -269,7 +271,7 @@ public class TestUriParserImpl { // simple entity set; with qualifiedentityTypeName testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?$id=ESBase") - .isEntityType(EdmTechProvider.nameETTwoPrim) + .isEntityType(EntityTypeProvider.nameETTwoPrim) .isIdText("ESBase"); // simple entity set; with qualifiedentityTypeName; with filter @@ -279,28 +281,28 @@ public class TestUriParserImpl { // simple entity set; with qualifiedentityTypeName; testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim") - .isEntityType(EdmTechProvider.nameETBase) + .isEntityType(EntityTypeProvider.nameETBase) .isKind(UriInfoKind.entityId) .isIdText("ESTwoPrim"); // simple entity set; with qualifiedentityTypeName; with format testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$format=atom") .isKind(UriInfoKind.entityId) - .isEntityType(EdmTechProvider.nameETBase) + .isEntityType(EntityTypeProvider.nameETBase) .isIdText("ESTwoPrim") .isFormatText("atom"); // simple entity set; with qualifiedentityTypeName; with select testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$select=*") .isKind(UriInfoKind.entityId) - .isEntityType(EdmTechProvider.nameETBase) + .isEntityType(EntityTypeProvider.nameETBase) .isIdText("ESTwoPrim") .isSelectItemStar(0); // simple entity set; with qualifiedentityTypeName; with expand testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$expand=*") .isKind(UriInfoKind.entityId) - .isEntityType(EdmTechProvider.nameETBase) + .isEntityType(EntityTypeProvider.nameETBase) .isIdText("ESTwoPrim") .isExpandText("*") .goExpand().first().isSegmentStar(0); @@ -321,12 +323,12 @@ public class TestUriParserImpl { // plain entity set testRes.run("ESAllPrim") .isEntitySet("ESAllPrim") - .isType(EdmTechProvider.nameETAllPrim); + .isType(EntityTypeProvider.nameETAllPrim); // with one key; simple key notation testRes.run("ESAllPrim(1)") .isEntitySet("ESAllPrim") - .isType(EdmTechProvider.nameETAllPrim) + .isType(EntityTypeProvider.nameETAllPrim) .isKeyPredicate(0, "PropertyInt16", "1"); // with one key; name value key notation @@ -367,42 +369,42 @@ public class TestUriParserImpl { testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne") .at(0) .isEntitySet("ESKeyNav") - .isType(EdmTechProvider.nameETKeyNav) + .isType(EntityTypeProvider.nameETKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .at(1) - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) - .isType(EdmTechProvider.nameETTwoKeyNav); + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav); // with navigation property -> property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString") .at(0) .isEntitySet("ESKeyNav") - .isType(EdmTechProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .at(1) - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) .at(2) - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); // with navigation property -> navigation property -> navigation property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne") .at(0) .isEntitySet("ESKeyNav") - .isType(EdmTechProvider.nameETKeyNav) + .isType(EntityTypeProvider.nameETKeyNav) .isKeyPredicate(0, "PropertyInt16", "1") .at(1) - .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) - .isType(EdmTechProvider.nameETTwoKeyNav) + .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav) .at(2) - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav); + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav); // with navigation property(key) testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)") .at(0) .isEntitySet("ESKeyNav") .at(1) - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1"); // with navigation property(key) -> property @@ -410,58 +412,58 @@ public class TestUriParserImpl { .at(0) .isEntitySet("ESKeyNav") .at(1) - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .at(2) - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); // with navigation property(key) -> navigation property testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne") .isEntitySet("ESKeyNav") .at(1) - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .at(2) - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false); + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false); // with navigation property(key) -> navigation property(key) testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)") .isEntitySet("ESKeyNav") - .isType(EdmTechProvider.nameETKeyNav) + .isType(EntityTypeProvider.nameETKeyNav) .at(1) - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .at(2) - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1"); // with navigation property(key) -> navigation property -> property testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne/PropertyString") .at(0) .isEntitySet("ESKeyNav") - .isType(EdmTechProvider.nameETKeyNav) + .isType(EntityTypeProvider.nameETKeyNav) .at(1) - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .at(2) - .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .isType(EdmTechProvider.nameETKeyNav) + .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .isType(EntityTypeProvider.nameETKeyNav) .at(3) - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); // with navigation property(key) -> navigation property(key) -> property testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)/PropertyString") .at(0) .isEntitySet("ESKeyNav") - .isType(EdmTechProvider.nameETKeyNav) + .isType(EntityTypeProvider.nameETKeyNav) .at(1) - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .at(2) - .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .at(3) - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); } @@ -476,7 +478,7 @@ public class TestUriParserImpl { .isEntitySet("ESAllPrim") .isKeyPredicate(0, "PropertyInt16", "1") .at(1) - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); // with complex property testRes.run("ESCompAllPrim(1)/PropertyComplex") @@ -484,7 +486,7 @@ public class TestUriParserImpl { .isEntitySet("ESCompAllPrim") .isKeyPredicate(0, "PropertyInt16", "1") .at(1) - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false); + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false); // with two properties testRes.run("ESCompAllPrim(1)/PropertyComplex/PropertyString") @@ -492,9 +494,9 @@ public class TestUriParserImpl { .isEntitySet("ESCompAllPrim") .isKeyPredicate(0, "PropertyInt16", "1") .at(1) - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false) .at(2) - .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); } @Test @@ -504,8 +506,8 @@ public class TestUriParserImpl { testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase") .at(0) .isEntitySet("ESTwoPrim") - .isType(EdmTechProvider.nameETTwoPrim,true) - .isTypeFilterOnCollection(EdmTechProvider.nameETBase) + .isType(EntityTypeProvider.nameETTwoPrim, true) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBase) .isTypeFilterOnEntry(null); // filter before key predicate @@ -513,34 +515,34 @@ public class TestUriParserImpl { .at(0) .isEntitySet("ESTwoPrim") .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoPrim) - .isTypeFilterOnCollection(EdmTechProvider.nameETBase) + .isType(EntityTypeProvider.nameETTwoPrim) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBase) .isTypeFilterOnEntry(null) .at(0) - .isType(EdmTechProvider.nameETTwoPrim,false) + .isType(EntityTypeProvider.nameETTwoPrim, false) .isKeyPredicate(0, "PropertyInt16", "1"); - + // filter before key predicate; property of sub type testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5") .at(0) .isEntitySet("ESTwoPrim") .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoPrim) - .isTypeFilterOnCollection(EdmTechProvider.nameETBase) + .isType(EntityTypeProvider.nameETTwoPrim) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBase) .isTypeFilterOnEntry(null) .isKeyPredicate(0, "PropertyInt16", "1") .at(1) - .isType(EdmTechProvider.nameString) - .isPrimitiveProperty("AdditionalPropertyString_5", EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameString) + .isPrimitiveProperty("AdditionalPropertyString_5", PropertyProvider.nameString, false); // filter after key predicate testRes.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase") .at(0) .isEntitySet("ESTwoPrim") .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoPrim,false) + .isType(EntityTypeProvider.nameETTwoPrim, false) .isTypeFilterOnCollection(null) - .isTypeFilterOnEntry(EdmTechProvider.nameETBase) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBase) .isKeyPredicate(0, "PropertyInt16", "1"); // filter after key predicate; property of sub type @@ -548,13 +550,13 @@ public class TestUriParserImpl { .at(0) .isEntitySet("ESTwoPrim") .isUriPathInfoKind(UriResourceKind.entitySet) - .isType(EdmTechProvider.nameETTwoPrim) + .isType(EntityTypeProvider.nameETTwoPrim) .isTypeFilterOnCollection(null) - .isTypeFilterOnEntry(EdmTechProvider.nameETBase) + .isTypeFilterOnEntry(EntityTypeProvider.nameETBase) .isKeyPredicate(0, "PropertyInt16", "1") .at(1) - .isPrimitiveProperty("AdditionalPropertyString_5", EdmTechProvider.nameString, false) - .isType(EdmTechProvider.nameString); + .isPrimitiveProperty("AdditionalPropertyString_5", PropertyProvider.nameString, false) + .isType(PropertyProvider.nameString); } @@ -591,19 +593,19 @@ public class TestUriParserImpl { testRes.run("FINRTInt16()") .isFunctionImport("FINRTInt16") .isFunction("UFNRTInt16") - .isType(EdmTechProvider.nameString); + .isType(PropertyProvider.nameInt16); // one input testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)") .isFunctionImport("FICRTETTwoKeyNavParam") .isFunction("UFCRTETTwoKeyNavParam") - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); // two input testRes.run("FICRTStringTwoParam(ParameterString='ABC',ParameterInt16=1)") .isFunctionImport("FICRTStringTwoParam") .isFunction("UFCRTStringTwoParam") - .isType(EdmTechProvider.nameString); + .isType(PropertyProvider.nameString); } @Test @@ -612,37 +614,37 @@ public class TestUriParserImpl { testRes.run("FINRTInt16()") .isFunctionImport("FINRTInt16") .isFunction("UFNRTInt16") - .isType(EdmTechProvider.nameString, false); + .isType(PropertyProvider.nameInt16, false); // returning collection of primitive testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)") .isFunctionImport("FICRTCollStringTwoParam") .isFunction("UFCRTCollStringTwoParam") - .isType(EdmTechProvider.nameString, true); + .isType(PropertyProvider.nameString, true); // returning single complex testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)") .isFunctionImport("FICRTCTAllPrimTwoParam") .isFunction("UFCRTCTAllPrimTwoParam") - .isType(EdmTechProvider.nameCTAllPrim, false); + .isType(ComplexTypeProvider.nameCTAllPrim, false); // returning collection of complex testRes.run("FICRTCollCTTwoPrim()") .isFunctionImport("FICRTCollCTTwoPrim") .isFunction("UFCRTCollCTTwoPrim") - .isType(EdmTechProvider.nameCTTwoPrim, true); + .isType(ComplexTypeProvider.nameCTTwoPrim, true); // returning single entity testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)") .isFunctionImport("FICRTETTwoKeyNavParam") .isFunction("UFCRTETTwoKeyNavParam") - .isType(EdmTechProvider.nameETTwoKeyNav, false); + .isType(EntityTypeProvider.nameETTwoKeyNav, false); // returning collection of entity (aka entitySet) testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)") .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") - .isType(EdmTechProvider.nameETTwoKeyNav, true); + .isType(EntityTypeProvider.nameETTwoKeyNav, true); } @Test @@ -653,28 +655,28 @@ public class TestUriParserImpl { .at(0) .isFunctionImport("FICRTCTAllPrimTwoParam") .isFunction("UFCRTCTAllPrimTwoParam") - .isType(EdmTechProvider.nameCTAllPrim, false) + .isType(ComplexTypeProvider.nameCTAllPrim, false) .isParameter(0, "ParameterString", "'ABC'") .isParameter(1, "ParameterInt16", "1") .at(1) - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); // test chains; returning single entity testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16") .at(0) .isFunctionImport("FICRTETTwoKeyNavParam") .isFunction("UFCRTETTwoKeyNavParam") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isParameter(0, "ParameterInt16", "1") .at(1) - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); // test chains; returning collection of entity (aka entitySet) testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')") .at(0) .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isParameter(0, "ParameterInt16", "1") .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'ABC'"); @@ -684,12 +686,12 @@ public class TestUriParserImpl { .at(0) .isFunctionImport("FICRTESTwoKeyNavParam") .isFunction("UFCRTESTwoKeyNavParam") - .isType(EdmTechProvider.nameETTwoKeyNav, false) + .isType(EntityTypeProvider.nameETTwoKeyNav, false) .isParameter(0, "ParameterInt16", "1") .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'ABC'") .at(1) - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); } @@ -866,7 +868,7 @@ public class TestUriParserImpl { // plain singleton testRes.run("SINav") .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav); + .isType(EntityTypeProvider.nameETTwoKeyNav); } @Test @@ -877,73 +879,73 @@ public class TestUriParserImpl { // with navigation property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false); + .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false); // with navigation property -> property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) - .at(2).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) + .at(2).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); // with navigation property -> navigation property -> navigation property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false) - .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false); + .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) + .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false); // with navigation property(key) testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'1'"); // with navigation property(key) -> property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/PropertyString") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'1'") - .at(2).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .at(2).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); // with navigation property(key) -> navigation property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/NavPropertyETKeyNavOne") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'1'") - .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false); + .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false); // with navigation property(key) -> navigation property(key) testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')" + "/NavPropertyETKeyNavMany(1)") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'1'") - .at(2).isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .at(2).isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1"); // with navigation property(key) -> navigation property -> property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')" + "/NavPropertyETKeyNavOne/PropertyString") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'1'") - .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) - .at(3).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false) + .at(3).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); // with navigation property(key) -> navigation property(key) -> property testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')" + "/NavPropertyETKeyNavMany(1)/PropertyString") .at(0).isEntitySet("ESKeyNav") - .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false) + .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'1'") - .at(2).isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false) + .at(2).isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) .isKeyPredicate(0, "PropertyInt16", "1") - .at(3).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .at(3).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); } @Test @@ -955,27 +957,27 @@ public class TestUriParserImpl { testRes.run("SINav/PropertyInt16") .at(0) .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .at(1) - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); // with complex property testRes.run("SINav/PropertyComplex") .at(0) .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .at(1) - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false); + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false); // with two properties testRes.run("SINav/PropertyComplex/PropertyInt16") .at(0) .isSingleton("SINav") - .isType(EdmTechProvider.nameETTwoKeyNav) + .isType(EntityTypeProvider.nameETTwoKeyNav) .at(1) - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .at(2) - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); } @@ -990,43 +992,43 @@ public class TestUriParserImpl { testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')?" + "$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate") .goFilter().root().isMember() - .isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath() + .isMemberStartType(EntityTypeProvider.nameETBaseTwoKeyNav).goPath() // .at(0) // .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - // .isType(EdmTechProvider.nameETTwoKeyNav, false) - // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) - .at(0).isType(EdmTechProvider.nameDate); + // .isType(EntityTypeProvider.nameETTwoKeyNav, false) + // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) + .at(0).isType(PropertyProvider.nameDate); // on EntityType collection testUri.run("ESTwoKeyNav?$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate") .goFilter().root().isMember() - .isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath() + .isMemberStartType(EntityTypeProvider.nameETBaseTwoKeyNav).goPath() // .at(0) // .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - // .isType(EdmTechProvider.nameETTwoKeyNav, true) - // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) - .at(0).isType(EdmTechProvider.nameDate); + // .isType(EntityTypeProvider.nameETTwoKeyNav, true) + // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) + .at(0).isType(PropertyProvider.nameDate); testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?" + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString") .goFilter().root().isMember() - .isMemberStartType(EdmTechProvider.nameCTBase).goPath() + .isMemberStartType(ComplexTypeProvider.nameCTBase).goPath() // .at(0) // .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - // .isType(EdmTechProvider.nameCTTwoPrim, false) - // .isTypeFilterOnEntry(EdmTechProvider.nameCTBase) - .at(0).isType(EdmTechProvider.nameString); + // .isType(ComplexTypeProvider.nameCTTwoPrim, false) + // .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase) + .at(0).isType(PropertyProvider.nameString); // on Complex collection testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?" + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString") .goFilter().root().isMember() - .isMemberStartType(EdmTechProvider.nameCTBase).goPath() + .isMemberStartType(ComplexTypeProvider.nameCTBase).goPath() // .at(0) // .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - // .isType(EdmTechProvider.nameCTTwoPrim, true) - // .isTypeFilterOnCollection(EdmTechProvider.nameCTBase) - .at(0).isType(EdmTechProvider.nameString); + // .isType(ComplexTypeProvider.nameCTTwoPrim, true) + // .isTypeFilterOnCollection(ComplexTypeProvider.nameCTBase) + .at(0).isType(PropertyProvider.nameString); } @@ -1084,37 +1086,37 @@ public class TestUriParserImpl { .isSelectItemAllOp(0, new FullQualifiedName("com.sap.odata.test1", "*")); testUri.run("ESTwoKeyNav?$select=PropertyString") - .goSelectItemPath(0).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false); + .goSelectItemPath(0).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); testUri.run("ESTwoKeyNav?$select=PropertyComplex") - .goSelectItemPath(0).isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false); + .goSelectItemPath(0).isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false); testUri.run("ESTwoKeyNav?$select=PropertyComplex/PropertyInt16") .goSelectItemPath(0) .first() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .n() - .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); + .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); testUri.run("ESTwoKeyNav?$select=PropertyComplex/PropertyComplex") .goSelectItemPath(0) .first() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false) + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTPrimComp, false) .n() - .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false); + .isComplexProperty("PropertyComplex", ComplexTypeProvider.nameCTAllPrim, false); testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.ETBaseTwoKeyNav") - .isSelectStartType(0, EdmTechProvider.nameETBaseTwoKeyNav); + .isSelectStartType(0, EntityTypeProvider.nameETBaseTwoKeyNav); testUri.run("ESTwoKeyNav/PropertyComplexNav?$select=com.sap.odata.test1.CTTwoBasePrimCompNav") - .isSelectStartType(0, EdmTechProvider.nameCTTwoBasePrimCompNav); + .isSelectStartType(0, ComplexTypeProvider.nameCTTwoBasePrimCompNav); testUri.run("ESTwoKeyNav?$select=PropertyComplexNav/com.sap.odata.test1.CTTwoBasePrimCompNav") .goSelectItemPath(0) .first() - .isComplexProperty("PropertyComplexNav", EdmTechProvider.nameCTBasePrimCompNav, false) + .isComplexProperty("PropertyComplexNav", ComplexTypeProvider.nameCTBasePrimCompNav, false) .n() - .isTypeFilterOnCollection(EdmTechProvider.nameCTTwoBasePrimCompNav); + .isTypeFilterOnCollection(ComplexTypeProvider.nameCTTwoBasePrimCompNav); ; } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java index 84217df3d..cce237edc 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.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. */ @@ -30,24 +30,6 @@ import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.server.core.testutil.EdmTechTestProvider; import org.apache.olingo.server.core.uri.UriInfoImpl; -import org.apache.olingo.server.core.uri.queryoption.AliasQueryOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl; -import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.IdOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.OrderByItemImpl; -import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.QueryOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.SearchOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.SelectItemImpl; -import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.SkipOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.SkipTokenOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.SystemQueryOptionImpl; -import org.apache.olingo.server.core.uri.queryoption.TopOptionImpl; import org.apache.olingo.server.core.uri.queryoption.expression.AliasImpl; import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl; import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl; diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java index 8eedce627..91f3ad99e 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.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. */ @@ -36,21 +36,14 @@ import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitEx import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; -import org.apache.olingo.server.core.testutil.EdmTechProvider; import org.apache.olingo.server.core.testutil.EdmTechTestProvider; +import org.apache.olingo.server.core.testutil.techprovider.ActionProvider; +import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider; +import org.apache.olingo.server.core.testutil.techprovider.EnumTypeProvider; +import org.apache.olingo.server.core.testutil.techprovider.FunctionProvider; import org.apache.olingo.server.core.uri.UriInfoImpl; import org.apache.olingo.server.core.uri.UriResourceActionImpl; import org.apache.olingo.server.core.uri.UriResourceFunctionImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.AliasImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.BinaryImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.EnumerationImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.LambdaRefImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.MemberImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.MethodImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.TypeLiteralImpl; -import org.apache.olingo.server.core.uri.queryoption.expression.UnaryImpl; import org.apache.olingo.server.core.uri.testutil.FilterTreeToText; import org.junit.Test; @@ -104,7 +97,7 @@ public class ExpressionTest { @Test public void testEnumerationExpression() throws ExpressionVisitException, ODataApplicationException { EnumerationImpl expression = new EnumerationImpl(); - EdmEnumType type = (EdmEnumType) edm.getEnumType(EdmTechProvider.nameENString); + EdmEnumType type = (EdmEnumType) edm.getEnumType(EnumTypeProvider.nameENString); assertNotNull(type); expression.setType(type); @@ -139,10 +132,10 @@ public class ExpressionTest { @Test public void testMemberExpression() throws ExpressionVisitException, ODataApplicationException { MemberImpl expression = new MemberImpl(); - EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav); + EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav); // UriResourceImplTyped - EdmAction action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null); + EdmAction action = edm.getAction(ActionProvider.nameUARTPrimParam, null, null); UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceActionImpl().setAction(action)).asUriInfoResource(); expression.setResourcePath(uriInfo); @@ -156,29 +149,29 @@ public class ExpressionTest { assertEquals(false, expression.isCollection()); // UriResourceImplTyped check collection = true case - action = edm.getAction(EdmTechProvider.nameUARTPrimCollParam, null, null); + action = edm.getAction(ActionProvider.nameUARTPrimCollParam, null, null); expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceActionImpl().setAction(action)) .asUriInfoResource()); assertEquals(true, expression.isCollection()); // UriResourceImplTyped with filter - action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null); + action = edm.getAction(ActionProvider.nameUARTPrimParam, null, null); expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceActionImpl().setAction(action).setTypeFilter(entityType)) .asUriInfoResource()); assertEquals(entityType, expression.getType()); // UriResourceImplKeyPred - EdmFunction function = edm.getFunction(EdmTechProvider.nameUFCRTETKeyNav, null, null, null); + EdmFunction function = edm.getFunction(FunctionProvider.nameUFCRTETKeyNav, null, null, null); expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceFunctionImpl().setFunction(function)) .asUriInfoResource()); assertEquals(function.getReturnType().getType(), expression.getType()); // UriResourceImplKeyPred typeFilter on entry - EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); - function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null, + EdmEntityType entityBaseType = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav); + function = edm.getFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam, null, null, Arrays.asList(("ParameterInt16"))); expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType)) @@ -186,8 +179,8 @@ public class ExpressionTest { assertEquals(entityBaseType, expression.getType()); // UriResourceImplKeyPred typeFilter on entry - entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); - function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null, + entityBaseType = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav); + function = edm.getFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam, null, null, Arrays.asList(("ParameterInt16"))); expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceFunctionImpl().setFunction(function).setCollectionTypeFilter(entityBaseType)) @@ -195,8 +188,8 @@ public class ExpressionTest { assertEquals(entityBaseType, expression.getType()); // no typed - entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); - function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null, + entityBaseType = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav); + function = edm.getFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam, null, null, Arrays.asList(("ParameterInt16"))); expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.all)); assertEquals(null, expression.getType()); @@ -225,7 +218,7 @@ public class ExpressionTest { @Test public void testTypeLiteralExpression() throws ExpressionVisitException, ODataApplicationException { TypeLiteralImpl expression = new TypeLiteralImpl(); - EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); + EdmEntityType entityBaseType = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav); expression.setType(entityBaseType); assertEquals(entityBaseType, expression.getType()); diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java index 2062c86ff..98cbce6a2 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.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. */ @@ -219,13 +219,12 @@ public class ExpandValidator implements Validator { } public ExpandValidator isExpandStartType(final FullQualifiedName fullName) { - EdmType actualType = expandItem.getStartTypeFilter(); - - FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); - assertEquals(fullName, actualName); - return this; - - + EdmType actualType = expandItem.getStartTypeFilter(); + + FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); + assertEquals(fullName, actualName); + return this; + } } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java index 7702a630c..06056e015 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java index 9565c38b4..2ee92f739 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.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. */ @@ -444,15 +444,15 @@ public class FilterValidator implements Validator { return this; } - + public FilterValidator isMemberStartType(final FullQualifiedName fullName) { if (!(curExpression instanceof MemberImpl)) { fail("Current expression not a member"); } - + MemberImpl member = (MemberImpl) curExpression; EdmType actualType = member.getStartTypeFilter(); - + FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); assertEquals(fullName, actualName); return this; diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java index 4582478ed..f6a308607 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java index b6237e4d9..3f73b97f0 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java index 2e3abf4bc..524a38a17 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java index 483fc5c56..039cebd3f 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.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. */ @@ -325,19 +325,21 @@ public class ResourceValidator implements Validator { } // TODO remove - /*public ResourceValidator isCollection(final boolean isCollection) { - if (!(uriPathInfo instanceof UriResourcePartTyped)) { - fail("invalid resource kind: " + uriPathInfo.getKind().toString()); - } - UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo; - - EdmType type = uriPathInfoTyped.getType(); - if (type == null) { - fail("isCollection: type == null"); - } - assertEquals(isCollection, uriPathInfoTyped.isCollection()); - return this; - }*/ + /* + * public ResourceValidator isCollection(final boolean isCollection) { + * if (!(uriPathInfo instanceof UriResourcePartTyped)) { + * fail("invalid resource kind: " + uriPathInfo.getKind().toString()); + * } + * UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo; + * + * EdmType type = uriPathInfoTyped.getType(); + * if (type == null) { + * fail("isCollection: type == null"); + * } + * assertEquals(isCollection, uriPathInfoTyped.isCollection()); + * return this; + * } + */ public ResourceValidator isFilterString(final String expectedFilterTreeAsString) { @@ -366,7 +368,7 @@ public class ResourceValidator implements Validator { return this; } - + public ResourceValidator isKeyPredicateAlias(final int index, final String name, final String alias) { if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) { fail("invalid resource kind: " + uriPathInfo.getKind().toString()); @@ -580,12 +582,12 @@ public class ResourceValidator implements Validator { return this; } - public ResourceValidator isSelectStartType(final int index, FullQualifiedName fullName) { + public ResourceValidator isSelectStartType(final int index, final FullQualifiedName fullName) { SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption(); SelectItem item = select.getSelectItems().get(index); EdmType actualType = item.getStartTypeFilter(); - + FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); assertEquals(fullName, actualName); return this; diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java index ab1fd2dfc..0153036dc 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java index cc73d11f0..4a94bb3e7 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java index da0181d51..9005080dc 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.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. */ diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriValidator.java index 5aa904762..e098f4c55 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriValidator.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/UriValidator.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. */ @@ -138,18 +138,17 @@ public class UriValidator implements Validator { .setUriInfoImplPath(uriInfo1); } - - public UriValidator isSelectStartType(int index, final FullQualifiedName fullName) { + + public UriValidator isSelectStartType(final int index, final FullQualifiedName fullName) { SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption(); SelectItem item = select.getSelectItems().get(index); EdmType actualType = item.getStartTypeFilter(); - + FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); assertEquals(fullName, actualName); return this; - - -} + + } // Validation public UriValidator isKind(final UriInfoKind kind) { diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/Validator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/Validator.java index a5d5cac87..caccc7859 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/Validator.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/Validator.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. */ diff --git a/pom.xml b/pom.xml index b3600ecd8..3f82dd4d1 100644 --- a/pom.xml +++ b/pom.xml @@ -231,6 +231,11 @@ org.apache.maven.plugins maven-compiler-plugin 3.1 + + true + true + -Xlint:unchecked + org.apache.maven.plugins @@ -326,6 +331,19 @@ + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + UTF-8 + false + + ${*} + + +